You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
according to the RFC 5652, when using SignedAttrs, the message digest should be calculated as
the complete DER encoding of the SignedAttrs value contained in the signedAttrs field
However, this is not happening right now as per code in SignedData.ts which uses BER encoding:
if(signerInfo.signedAttrs){if(signerInfo.signedAttrs.encodedValue.byteLength!==0)data=signerInfo.signedAttrs.encodedValue;else{data=signerInfo.signedAttrs.toSchema().toBER();//#region Change type from "[0]" to "SET" accordingly to standardconstview=pvtsutils.BufferSourceConverter.toUint8Array(data);view[0]=0x31;//#endregion}}
The main problem that I have is that when passing attributes into the SignedAndUnsignedAttributes, the message digest depends on the order I specify the attributes. I believe this should not be happening and the message digest should be the same, independent of the attributes order.
This causes problems when verifying the signature with Java Bouncy Castle library, which expects the DER (ordered) encoding of the signed attributes.
Hello,
according to the RFC 5652, when using SignedAttrs, the message digest should be calculated as
However, this is not happening right now as per code in SignedData.ts which uses BER encoding:
The main problem that I have is that when passing attributes into the SignedAndUnsignedAttributes, the message digest depends on the order I specify the attributes. I believe this should not be happening and the message digest should be the same, independent of the attributes order.
This causes problems when verifying the signature with Java Bouncy Castle library, which expects the DER (ordered) encoding of the signed attributes.
Examples
This attribute order does not validate
Switching positions of SigningTime and MessageDigest produces a valid signature
The text was updated successfully, but these errors were encountered: