|
36 | 36 | ASN1F_ISO646_STRING, |
37 | 37 | ASN1F_NULL, |
38 | 38 | ASN1F_OID, |
| 39 | + ASN1F_omit, |
39 | 40 | ASN1F_optional, |
40 | 41 | ASN1F_PACKET, |
41 | 42 | ASN1F_PRINTABLE_STRING, |
@@ -866,6 +867,27 @@ class X509_AlgorithmIdentifier(ASN1_Packet): |
866 | 867 | ASN1F_OID("algorithm", "1.2.840.113549.1.1.11"), |
867 | 868 | MultipleTypeField( |
868 | 869 | [ |
| 870 | + # RFC4055 |
| 871 | + ( |
| 872 | + # "The correct encoding is to omit the parameters field" |
| 873 | + # "All implementations MUST accept both NULL and absent parameters as |
| 874 | + # legal and equivalent encodings." |
| 875 | + ASN1F_optional(ASN1F_NULL("parameters", None)), |
| 876 | + lambda pkt: pkt.algorithm.val[:19] == "1.2.840.113549.1.1.", |
| 877 | + ), |
| 878 | + # RFC8017 |
| 879 | + ( |
| 880 | + # "should generally be omitted, but if present, it shall have a |
| 881 | + # value of type NULL." |
| 882 | + ASN1F_optional(ASN1F_NULL("parameters", None)), |
| 883 | + lambda pkt: pkt.algorithm.val[:21] == "2.16.840.1.101.3.4.2.", |
| 884 | + ), |
| 885 | + # RFC5758 |
| 886 | + ( |
| 887 | + # "the encoding MUST omit the parameters field" |
| 888 | + ASN1F_omit("parameters", None), |
| 889 | + lambda pkt: pkt.algorithm.val[:16] == "1.2.840.10045.4.", |
| 890 | + ), |
869 | 891 | # RFC5480 |
870 | 892 | ( |
871 | 893 | ASN1F_PACKET( |
@@ -893,10 +915,9 @@ class X509_AlgorithmIdentifier(ASN1_Packet): |
893 | 915 | ), |
894 | 916 | lambda pkt: pkt.algorithm.val == "1.2.840.113549.1.3.1", |
895 | 917 | ), |
896 | | - |
897 | 918 | ], |
898 | | - # RFC4055 (=1.2.840.113549.1.1.11) / Default |
899 | | - ASN1F_optional(ASN1F_NULL("parameters", 0)), |
| 919 | + # Default: fail, probably. This is most likely unimplemented. |
| 920 | + ASN1F_NULL("parameters", 0), |
900 | 921 | ) |
901 | 922 | ) |
902 | 923 |
|
|
0 commit comments