mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-22 05:51:44 +03:00
Merge branch 'feat/rsa-dsa-sign-verif' into chore/all-my-stuffs
# Conflicts: # components.d.ts # package.json # pnpm-lock.yaml # src/tools/index.ts # vite.config.ts
This commit is contained in:
commit
bf46a8ea23
6 files changed
+164
-5
No files matched your search
@@ -86,6 +86,7 @@
|
|||||||
"@types/figlet": "^1.5.8",
|
"@types/figlet": "^1.5.8",
|
||||||
"@types/markdown-it": "^13.0.7",
|
"@types/markdown-it": "^13.0.7",
|
||||||
"@types/memorystream": "^0.3.4",
|
"@types/memorystream": "^0.3.4",
|
||||||
|
"@types/sshpk": "^1.17.4",
|
||||||
"@vicons/material": "^0.12.0",
|
"@vicons/material": "^0.12.0",
|
||||||
"@vicons/tabler": "^0.12.0",
|
"@vicons/tabler": "^0.12.0",
|
||||||
"@vueuse/core": "^10.11.1",
|
"@vueuse/core": "^10.11.1",
|
||||||
|
|||||||
Generated
+6
-5
@@ -119,6 +119,9 @@ dependencies:
|
|||||||
'@types/punycode':
|
'@types/punycode':
|
||||||
specifier: ^2.1.4
|
specifier: ^2.1.4
|
||||||
version: 2.1.4
|
version: 2.1.4
|
||||||
|
'@types/sshpk':
|
||||||
|
specifier: ^1.17.4
|
||||||
|
version: 1.17.4
|
||||||
'@types/turndown':
|
'@types/turndown':
|
||||||
specifier: ^5.0.4
|
specifier: ^5.0.4
|
||||||
version: 5.0.5
|
version: 5.0.5
|
||||||
@@ -568,9 +571,6 @@ devDependencies:
|
|||||||
'@types/qrcode':
|
'@types/qrcode':
|
||||||
specifier: ^1.5.0
|
specifier: ^1.5.0
|
||||||
version: 1.5.0
|
version: 1.5.0
|
||||||
'@types/sshpk':
|
|
||||||
specifier: ^1.17.4
|
|
||||||
version: 1.17.4
|
|
||||||
'@types/ua-parser-js':
|
'@types/ua-parser-js':
|
||||||
specifier: ^0.7.36
|
specifier: ^0.7.36
|
||||||
version: 0.7.36
|
version: 0.7.36
|
||||||
@@ -5042,7 +5042,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-V91DSJ2l0h0gRhVP4oBfBzRBN9lAbPUkGDMCnwedqPKX2d84aAMc9CulOvxdw1f7DfEYx99afab+Rsm3e52jhA==}
|
resolution: {integrity: sha512-V91DSJ2l0h0gRhVP4oBfBzRBN9lAbPUkGDMCnwedqPKX2d84aAMc9CulOvxdw1f7DfEYx99afab+Rsm3e52jhA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 18.18.8
|
'@types/node': 18.18.8
|
||||||
dev: true
|
dev: false
|
||||||
|
|
||||||
/@types/bcryptjs@2.4.2:
|
/@types/bcryptjs@2.4.2:
|
||||||
resolution: {integrity: sha512-LiMQ6EOPob/4yUL66SZzu6Yh77cbzJFYll+ZfaPiPPFswtIlA/Fs1MzdKYA7JApHU49zQTbJGX3PDmCpIdDBRQ==}
|
resolution: {integrity: sha512-LiMQ6EOPob/4yUL66SZzu6Yh77cbzJFYll+ZfaPiPPFswtIlA/Fs1MzdKYA7JApHU49zQTbJGX3PDmCpIdDBRQ==}
|
||||||
@@ -5291,7 +5291,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/asn1': 0.2.4
|
'@types/asn1': 0.2.4
|
||||||
'@types/node': 18.18.8
|
'@types/node': 18.18.8
|
||||||
dev: true
|
dev: false
|
||||||
|
|
||||||
/@types/throttle-debounce@2.1.0:
|
/@types/throttle-debounce@2.1.0:
|
||||||
resolution: {integrity: sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==}
|
resolution: {integrity: sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==}
|
||||||
@@ -10106,6 +10106,7 @@ packages:
|
|||||||
/jsesc@2.5.2:
|
/jsesc@2.5.2:
|
||||||
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
|
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
/jsesc@3.0.2:
|
/jsesc@3.0.2:
|
||||||
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
|
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { tool as markdownTocGenerator } from './markdown-toc-generator';
|
|||||||
import { tool as passphraseGenerator } from './passphrase-generator';
|
import { tool as passphraseGenerator } from './passphrase-generator';
|
||||||
import { tool as pinCodeGenerator } from './pin-code-generator';
|
import { tool as pinCodeGenerator } from './pin-code-generator';
|
||||||
import { tool as punycodeConverter } from './punycode-converter';
|
import { tool as punycodeConverter } from './punycode-converter';
|
||||||
|
import { tool as rsaEcdsaSigning } from './rsa-ecdsa-signing';
|
||||||
|
|
||||||
import { tool as cssXpathConverter } from './css-xpath-converter';
|
import { tool as cssXpathConverter } from './css-xpath-converter';
|
||||||
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
import { tool as cssSelectorsMemo } from './css-selectors-memo';
|
||||||
@@ -191,6 +192,10 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
pdfUnlock,
|
pdfUnlock,
|
||||||
passwordStrengthAnalyser,
|
passwordStrengthAnalyser,
|
||||||
pdfSignatureChecker,
|
pdfSignatureChecker,
|
||||||
|
passwordStrengthAnalyser,
|
||||||
|
pdfSignatureChecker,
|
||||||
|
// pgpEncryption,
|
||||||
|
rsaEcdsaSigning,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Lock } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'RSA/DSA/ECDSA Signer and Verifier',
|
||||||
|
path: '/rsa-ecdsa-signing',
|
||||||
|
description: 'Sign data and verify signature using RSA/DSA/ECDSA Keys',
|
||||||
|
keywords: ['rsa', 'dsa', 'ecdsa', 'ed25519', 'encryption', 'cypher', 'encipher', 'crypt', 'decrypt'],
|
||||||
|
component: () => import('./rsa-ecdsa-signing.vue'),
|
||||||
|
icon: Lock,
|
||||||
|
createdAt: new Date('2024-05-01'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import sshpk from 'sshpk';
|
||||||
|
import { computedCatch } from '@/composable/computed/catchedComputed';
|
||||||
|
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||||
|
|
||||||
|
const hashTypes = [
|
||||||
|
'sha1', 'sha256', 'sha384', 'sha512', 'md5',
|
||||||
|
];
|
||||||
|
|
||||||
|
const verifyText = ref('');
|
||||||
|
const verifySignature = ref('');
|
||||||
|
const verifyPublicKey = ref('');
|
||||||
|
const [verifyOutput, verifyError] = computedCatch(() => {
|
||||||
|
const publicKey = sshpk.parseKey(verifyPublicKey.value, 'auto');
|
||||||
|
|
||||||
|
const v = publicKey.createVerify();
|
||||||
|
v.update(verifyText.value);
|
||||||
|
return v.verify(verifySignature.value);
|
||||||
|
}, {
|
||||||
|
defaultValue: '',
|
||||||
|
defaultErrorMessage: 'Unable to verify your text',
|
||||||
|
});
|
||||||
|
|
||||||
|
const signText = ref('');
|
||||||
|
const signPrivateKey = ref('');
|
||||||
|
const signPrivateKeyPassphrase = ref('');
|
||||||
|
const signHashType = ref('sha1');
|
||||||
|
const [signOutput, signError] = computedCatch(() => {
|
||||||
|
const privateKey = sshpk.parsePrivateKey(signPrivateKey.value, 'auto', { passphrase: signPrivateKeyPassphrase.value });
|
||||||
|
const s = privateKey.createSign(signHashType.value as sshpk.AlgorithmHashType);
|
||||||
|
s.update(signText.value);
|
||||||
|
const signature = s.sign();
|
||||||
|
return {
|
||||||
|
asn1: signature.toString('asn1'),
|
||||||
|
ssh: signature.toString('ssh'),
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
defaultValue: {
|
||||||
|
asn1: '',
|
||||||
|
ssh: '',
|
||||||
|
},
|
||||||
|
defaultErrorMessage: 'Unable to sign your text',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-card title="Sign">
|
||||||
|
<div>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="signText"
|
||||||
|
label="Your text:"
|
||||||
|
placeholder="The string to sign"
|
||||||
|
rows="4"
|
||||||
|
multiline raw-text monospace autosize flex-1
|
||||||
|
/>
|
||||||
|
<c-select
|
||||||
|
v-model:value="signHashType"
|
||||||
|
label="Hash Type:"
|
||||||
|
:options="hashTypes"
|
||||||
|
placeholder="Select the hashing algorithm"
|
||||||
|
/>
|
||||||
|
<div flex flex-1 flex-col gap-2>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="signPrivateKey"
|
||||||
|
label="Your private key:"
|
||||||
|
placeholder="The private key to use to sign message"
|
||||||
|
rows="5"
|
||||||
|
multiline raw-text monospace autosize flex-1
|
||||||
|
/>
|
||||||
|
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="signPrivateKeyPassphrase"
|
||||||
|
label="Your private key password:" clearable raw-text
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c-alert v-if="signError && signPrivateKey !== ''" type="error" mt-12 title="Error while signing">
|
||||||
|
{{ signError }}
|
||||||
|
</c-alert>
|
||||||
|
|
||||||
|
<n-form-item label="ASN1 Signature:" mt-3>
|
||||||
|
<TextareaCopyable
|
||||||
|
:value="signOutput?.asn1 || ''"
|
||||||
|
placeholder="ASN1 Signature"
|
||||||
|
multiline monospace readonly autosize mt-5
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="SSH Signature:" mt-3>
|
||||||
|
<TextareaCopyable
|
||||||
|
:value="signOutput?.ssh || ''"
|
||||||
|
placeholder="SSG Signature"
|
||||||
|
multiline monospace readonly autosize mt-5
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="Verify">
|
||||||
|
<div>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="verifyText"
|
||||||
|
label="Your text to verify:"
|
||||||
|
placeholder="The string to verify"
|
||||||
|
rows="4"
|
||||||
|
multiline raw-text monospace autosize flex-1
|
||||||
|
/>
|
||||||
|
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="verifySignature"
|
||||||
|
label="Associated signature:"
|
||||||
|
placeholder="Text signature"
|
||||||
|
rows="4"
|
||||||
|
multiline raw-text monospace autosize flex-1
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div flex flex-1 flex-col gap-2>
|
||||||
|
<c-input-text
|
||||||
|
v-model:value="verifyPublicKey"
|
||||||
|
label="Public key:"
|
||||||
|
placeholder="Public key"
|
||||||
|
rows="5"
|
||||||
|
multiline raw-text monospace autosize flex-1
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c-alert v-if="verifyError && verifyPublicKey !== ''" type="error" mt-12 title="Error while verifying">
|
||||||
|
{{ verifyError }}
|
||||||
|
</c-alert>
|
||||||
|
<c-alert v-if="verifyOutput && verifyPublicKey !== ''" type="error" mt-12 title="Signature failed">
|
||||||
|
Signature is NOT valid for the given text
|
||||||
|
</c-alert>
|
||||||
|
<n-alert v-if="!verifyOutput && verifyPublicKey !== ''" type="success" mt-12 title="Signature verified">
|
||||||
|
Signature is valid for the given text
|
||||||
|
</n-alert>
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { URL, fileURLToPath } from 'node:url';
|
import { URL, fileURLToPath } from 'node:url';
|
||||||
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||||
|
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||||
|
|
||||||
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
|
|||||||
Reference in new issue
Block a user