-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Brian DeHamer <bdehamer@github.com>
- Loading branch information
Showing
10 changed files
with
351 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@sigstore/mock": patch | ||
--- | ||
|
||
Introduce intermediate certificate for issuing RFC3161 timestamps |
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,5 @@ | ||
--- | ||
"@sigstore/mock": patch | ||
--- | ||
|
||
Fix encoding for TSA-issued timestamps |
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
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,34 @@ | ||
import * as asn1js from 'asn1js'; | ||
import * as pkijs from 'pkijs'; | ||
import { ESSCertIDv2 } from './ess-cert-id'; | ||
|
||
describe('ESSCertIDv2', () => { | ||
describe('constructor', () => { | ||
describe('when no parameters are provided', () => { | ||
it('should set the certHash and issuerSerial to empty buffers', () => { | ||
const essCertIDv2 = new ESSCertIDv2(); | ||
expect(essCertIDv2).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe('when parameters are provided', () => { | ||
it('should set the certHash and issuerSerial', () => { | ||
const certHash = new asn1js.OctetString({ | ||
valueHex: new ArrayBuffer(0), | ||
}); | ||
const issuerSerial = new pkijs.IssuerSerial({ | ||
issuer: new pkijs.GeneralNames({ | ||
names: [ | ||
new pkijs.GeneralName({ type: 4, value: new ArrayBuffer(0) }), | ||
], | ||
}), | ||
serialNumber: new asn1js.Integer({ value: 888 }), | ||
}); | ||
const essCertIDv2 = new ESSCertIDv2({ certHash, issuerSerial }); | ||
|
||
expect(essCertIDv2.certHash).toBe(certHash); | ||
expect(essCertIDv2.issuerSerial).toBe(issuerSerial); | ||
}); | ||
}); | ||
}); | ||
}); |
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,54 @@ | ||
import * as asn1js from 'asn1js'; | ||
import * as pkijs from 'pkijs'; | ||
import * as pvutils from 'pvutils'; | ||
|
||
const CERT_HASH = 'certHash'; | ||
const ISSUER_SERIAL = 'issuerSerial'; | ||
|
||
interface IESSCertIDv2 { | ||
certHash: asn1js.OctetString; | ||
issuerSerial: pkijs.IssuerSerial; | ||
} | ||
|
||
type ESSCertIDv2Parameters = pkijs.PkiObjectParameters & Partial<IESSCertIDv2>; | ||
|
||
// https://datatracker.ietf.org/doc/html/rfc5035#section-4 | ||
export class ESSCertIDv2 extends pkijs.PkiObject implements IESSCertIDv2 { | ||
public static override CLASS_NAME = 'ESSCertIDv2'; | ||
|
||
public certHash!: asn1js.OctetString; | ||
public issuerSerial!: pkijs.IssuerSerial; | ||
|
||
constructor(parameters: ESSCertIDv2Parameters = {}) { | ||
super(); | ||
|
||
this.certHash = pvutils.getParametersValue( | ||
parameters, | ||
CERT_HASH, | ||
new asn1js.OctetString() | ||
); | ||
this.issuerSerial = pvutils.getParametersValue( | ||
parameters, | ||
ISSUER_SERIAL, | ||
new pkijs.IssuerSerial() | ||
); | ||
} | ||
|
||
public override toSchema(): asn1js.Sequence { | ||
const result = new asn1js.Sequence({ | ||
value: [this.certHash, this.issuerSerial.toSchema()], | ||
}); | ||
|
||
return result; | ||
} | ||
|
||
/* istanbul ignore next */ | ||
public override fromSchema(): void { | ||
throw new Error('Not implemented'); | ||
} | ||
|
||
/* istanbul ignore next */ | ||
public override toJSON(): IESSCertIDv2 { | ||
throw new Error('Not implemented'); | ||
} | ||
} |
Oops, something went wrong.