Skip to content

Commit 1e17818

Browse files
committed
fix(Certificate Parser): add validity dates and enhance extension display
1 parent 68f8e39 commit 1e17818

File tree

3 files changed

+886
-1
lines changed

3 files changed

+886
-1
lines changed

components.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ declare module '@vue/runtime-core' {
248248
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
249249
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
250250
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
251+
NDivider: typeof import('naive-ui')['NDivider']
251252
NEllipsis: typeof import('naive-ui')['NEllipsis']
252253
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
253254
NH1: typeof import('naive-ui')['NH1']
@@ -256,6 +257,9 @@ declare module '@vue/runtime-core' {
256257
NLayout: typeof import('naive-ui')['NLayout']
257258
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
258259
NMenu: typeof import('naive-ui')['NMenu']
260+
NRadio: typeof import('naive-ui')['NRadio']
261+
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
262+
NSpace: typeof import('naive-ui')['NSpace']
259263
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
260264
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
261265
Option43Generator: typeof import('./src/tools/option43-generator/option43-generator.vue')['default']

src/tools/certificate-key-parser/certificate-key-parser.infos.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
} from 'sshpk';
77
import type * as openpgp from 'openpgp';
88
import * as forge from 'node-forge';
9+
import oids from './oids.json';
910

1011
export interface LabelValue {
1112
label: string
@@ -111,6 +112,14 @@ export function getCertificateLabelValues(cert: Certificate) {
111112
value: cert.subjects?.map(s => s.toString()).join('\n'),
112113
multiline: true,
113114
},
115+
{
116+
label: 'Valid From:',
117+
value: cert.validFrom.toISOString(),
118+
},
119+
{
120+
label: 'Valid Until:',
121+
value: cert.validUntil.toISOString(),
122+
},
114123
{
115124
label: 'Issuer:',
116125
value: cert.issuer.toString(),
@@ -153,7 +162,12 @@ export function getCertificateLabelValues(cert: Certificate) {
153162
},
154163
{
155164
label: 'Extensions:',
156-
value: JSON.stringify(cert.getExtensions(), null, 2),
165+
value: JSON.stringify(cert.getExtensions().map(ext => ({
166+
oid: (<any>ext).oid,
167+
name: (<any>ext).name || (<any>oids)[(<any>ext).oid],
168+
critical: (<any>ext).critical,
169+
data: ext.data?.toString('hex') || (<any>ext).bits?.toString('hex'),
170+
})), null, 2),
157171
multiline: true,
158172
},
159173
{

0 commit comments

Comments
 (0)