forked from CorentinTh/it-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(new tool): pdf signature checker (CorentinTh#745)
- Loading branch information
1 parent
205e360
commit 4781920
Showing
20 changed files
with
448 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
src/tools/pdf-signature-checker/components/pdf-signature-details.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<script setup lang="ts"> | ||
import type { SignatureInfo } from '../pdf-signature-checker.types'; | ||
const props = defineProps<{ signature: SignatureInfo }>(); | ||
const { signature } = toRefs(props); | ||
const tableHeaders = { | ||
validityPeriod: 'Validity period', | ||
issuedBy: 'Issued by', | ||
issuedTo: 'Issued to', | ||
pemCertificate: 'PEM certificate', | ||
}; | ||
const certs = computed(() => signature.value.meta.certs.map((certificate, index) => ({ | ||
...certificate, | ||
validityPeriod: { | ||
notBefore: new Date(certificate.validityPeriod.notBefore).toLocaleString(), | ||
notAfter: new Date(certificate.validityPeriod.notAfter).toLocaleString(), | ||
}, | ||
certificateName: `Certificate ${index + 1}`, | ||
})), | ||
); | ||
</script> | ||
|
||
<template> | ||
<div flex flex-col gap-2> | ||
<c-table :data="certs" :headers="tableHeaders"> | ||
<template #validityPeriod="{ value }"> | ||
<c-key-value-list | ||
:items="[{ | ||
label: 'Not before', | ||
value: value.notBefore, | ||
}, { | ||
label: 'Not after', | ||
value: value.notAfter, | ||
}]" | ||
/> | ||
</template> | ||
|
||
<template #issuedBy="{ value }"> | ||
<c-key-value-list | ||
:items="[{ | ||
label: 'Common name', | ||
value: value.commonName, | ||
}, { | ||
label: 'Organization name', | ||
value: value.organizationName, | ||
}, { | ||
label: 'Country name', | ||
value: value.countryName, | ||
}, { | ||
label: 'Locality name', | ||
value: value.localityName, | ||
}, { | ||
label: 'Organizational unit name', | ||
value: value.organizationalUnitName, | ||
}, { | ||
label: 'State or province name', | ||
value: value.stateOrProvinceName, | ||
}]" | ||
/> | ||
</template> | ||
|
||
<template #issuedTo="{ value }"> | ||
<c-key-value-list | ||
:items="[{ | ||
label: 'Common name', | ||
value: value.commonName, | ||
}, { | ||
label: 'Organization name', | ||
value: value.organizationName, | ||
}, { | ||
label: 'Country name', | ||
value: value.countryName, | ||
}, { | ||
label: 'Locality name', | ||
value: value.localityName, | ||
}, { | ||
label: 'Organizational unit name', | ||
value: value.organizationalUnitName, | ||
}, { | ||
label: 'State or province name', | ||
value: value.stateOrProvinceName, | ||
}]" | ||
/> | ||
</template> | ||
|
||
<template #pemCertificate="{ value }"> | ||
<c-modal-value :value="value" label="View PEM cert"> | ||
<template #value> | ||
<div break-all text-xs> | ||
{{ value }} | ||
</div> | ||
</template> | ||
</c-modal-value> | ||
</template> | ||
</c-table> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineTool } from '../tool'; | ||
import FileCertIcon from '~icons/mdi/file-certificate-outline'; | ||
|
||
export const tool = defineTool({ | ||
name: 'PDF signature checker', | ||
path: '/pdf-signature-checker', | ||
description: 'Verify the signatures of a PDF file. A signed PDF file contains one or more signatures that may be used to determine whether the contents of the file have been altered since the file was signed.', | ||
keywords: ['pdf', 'signature', 'checker', 'verify', 'validate', 'sign'], | ||
component: () => import('./pdf-signature-checker.vue'), | ||
icon: FileCertIcon, | ||
createdAt: new Date('2023-12-09'), | ||
}); |
11 changes: 11 additions & 0 deletions
11
src/tools/pdf-signature-checker/pdf-signature-checker.e2e.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('Tool - Pdf signature checker', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/pdf-signature-checker'); | ||
}); | ||
|
||
test('Has correct title', async ({ page }) => { | ||
await expect(page).toHaveTitle('PDF signature checker - IT Tools'); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
src/tools/pdf-signature-checker/pdf-signature-checker.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export interface SignatureInfo { | ||
verified: boolean | ||
authenticity: boolean | ||
integrity: boolean | ||
expired: boolean | ||
meta: { | ||
certs: { | ||
clientCertificate?: boolean | ||
issuedBy: { | ||
commonName: string | ||
organizationalUnitName?: string | ||
organizationName: string | ||
countryName?: string | ||
localityName?: string | ||
stateOrProvinceName?: string | ||
} | ||
issuedTo: { | ||
commonName: string | ||
serialNumber?: string | ||
organizationalUnitName?: string | ||
organizationName: string | ||
countryName?: string | ||
localityName?: string | ||
stateOrProvinceName?: string | ||
} | ||
validityPeriod: { | ||
notBefore: string | ||
notAfter: string | ||
} | ||
pemCertificate: string | ||
}[] | ||
signatureMeta: { | ||
reason: string | ||
contactInfo: string | null | ||
location: string | ||
name: string | null | ||
} | ||
} | ||
} |
Oops, something went wrong.