Skip to content

Commit e06afc4

Browse files
troyfactor4dlongley
authored andcommitted
fix: make PKCS#7 parameter optional as per RFC 5280
1 parent 588c410 commit e06afc4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/pkcs7.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ function _recipientFromAsn1(obj) {
837837
serialNumber: forge.util.createBuffer(capture.serial).toHex(),
838838
encryptedContent: {
839839
algorithm: asn1.derToOid(capture.encAlgorithm),
840-
parameter: capture.encParameter.value,
840+
parameter: capture.encParameter ? capture.encParameter.value : null,
841841
content: capture.encKey
842842
}
843843
};

lib/pkcs7asn1.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ p7v.recipientInfoValidator = {
397397
name: 'RecipientInfo.keyEncryptionAlgorithm.parameter',
398398
tagClass: asn1.Class.UNIVERSAL,
399399
constructed: false,
400-
captureAsn1: 'encParameter'
400+
captureAsn1: 'encParameter',
401+
optional: true
401402
}]
402403
}, {
403404
name: 'RecipientInfo.encryptedKey',

0 commit comments

Comments
 (0)