attestation
attestation copied to clipboard
Implmenet PublicKeyInfo
It's used in SignedDevconTicket
.
While PublicKeyInfo is still useful (in IdentifierAttestation I suppose), I'm making the argument of not including it in SignedDevconTicket (the one that should be delivered by the end of 2020 but haven't due to refactoring of the ASN schema).
@jot2re decided to keep PublicKeyInfo
optional instead of dropping it, so this issue can continue now.
Hi Weiwu,
I have completed the extracting PublicKeyInfo from the DER encoded data in SignedDevconTicket. Also added a test case in ParserSerializerTest.js.
Test Case:
// get PublicKeyInfo
const derpk = readFileSync('build/test-results/signed-devcon-ticket-with-pk.der');
let dataobj2 = new SignedDevconTicket(new Uint8Array(derpk).buffer);
console.log(dataobj2);
Result:
SignedDevconTicket {
ticket: DevconTicket {
devconId: ArrayBuffer { [Uint8Contents]: <06>, byteLength: 1 },
ticketId: ArrayBuffer { [Uint8Contents]: <00 be 06>, byteLength: 3 },
ticketClass: ArrayBuffer { [Uint8Contents]: <00>, byteLength: 1 }
},
commitment: ArrayBuffer {
[Uint8Contents]: <04 20 64 30 ca e2 02 e5 fa b4 1c e5 4b 74 72 5e 45 4f f8 08 72 0a 03 90 37 d8 40 3d 95 fe fd c0 35 12 2c 95 bf d2 ae 1a 48 a3 f4 2f
0b 8e 78 fb 79 23 51 ad e2 0a 22 09 a3 1f 4e 90 dc 61 a4 d5 0f>,
byteLength: 65
},
publicKeyInfo: PublicKeyInfo {
algorithm: AlgorithmIdentifier {
algorithmId: '1.2.840.10045.2.1',
algorithmParams: [Sequence]
},
subjectPublicKey: BitString {
blockLength: 68,
error: '',
warnings: [],
valueBeforeDecode: [ArrayBuffer],
idBlock: [LocalIdentificationBlock],
lenBlock: [LocalLengthBlock],
valueBlock: [LocalBitStringValueBlock]
}
},
signatureValue: ArrayBuffer {
[Uint8Contents]: <30 44 02 20 38 db 21 b6 b5 b7 c6 92 da ad a2 b6 2e bb 89 e5 a3 6e 3a 3c ce 66 1e 38 53 2b c9 ac c8 5c 34 1b 02 20 70 46 73 21 8f 77
b2 47 b5 51 ab 3c 3d 74 e1 ef 8f 4f 7e 3a e0 40 1d 53 54 26 65 3a aa 5e c2 a2>,
byteLength: 70
}
}
The related code is pushed in branch - asn1js-parser-serializer
@jot2re his work can be verified by running
$ gradle test
$ gradle testJavaScript
I'll attempt to add some integration test on top of it so the DER from java is parsed by JavaScript then the other way too.
All the tests seem to pass on my machine. @darakhbharat is this ready for review?
All the tests seem to pass on my machine. @darakhbharat is this ready for review?
Yes. I mean:
#75 - Decoding PublicKeyInfo from the DER data is completed. #65 - Implemented serialize method which creates exactly same DER data when decoded to object from the existing DER file and serialize it to new file. - JS serialize using instantiating the dictionary object is not completed yet.