Commit dc99309
Add DerSequence.insert()
Use-case: ease semantic creation of optional fields, such as
https://www.rfc-editor.org/rfc/rfc5652#section-6.2.4
Brief illustration:
def construct_pwri(encrypted_cek, ke_alg, kdf_alg=None):
recipient = DerSequence([DerInteger(0), ke_alg, DerOctetString(encrypted_cek)])
if kdf_alg is not None:
if kdf_alg._tag_octet != 0xa0:
raise ValueError("keyDerivationAlgorithm is of type [0] IMPLICIT SEQUENCE OPTIONAL")
recipient.insert(1, kdf_alg)
return recipient1 parent 0be2f1a commit dc99309
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
533 | 537 | | |
534 | 538 | | |
535 | 539 | | |
| |||
0 commit comments