diff --git a/.gitattributes b/.gitattributes index 95aea4dca2c94bace0cdf8f1b34d26dc86013cc0..327ee3e43d8e06481f0ceb76938621ea0d7d2a35 100644 --- a/.gitattributes +++ b/.gitattributes @@ -193,7 +193,10 @@ testfont binary /lib/modules/Standards.pmod/EXIF.pmod foreign_ident /lib/modules/Standards.pmod/FIPS10_4.pmod foreign_ident /lib/modules/Standards.pmod/ID3.pmod foreign_ident +/lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod foreign_ident /lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod foreign_ident +/lib/modules/Standards.pmod/PKCS.pmod/DSA.pmod foreign_ident +/lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod foreign_ident /lib/modules/Standards.pmod/PKCS.pmod/PFX.pmod foreign_ident /lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod foreign_ident /lib/modules/Standards.pmod/RDF.pike foreign_ident diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod index e814d4c27b20b0de682d3828c4a0f7981c183a90..6b6639002a82aec2713ffd744f8677f72132d074 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Decode.pmod @@ -1,5 +1,5 @@ // -// $Id: Decode.pmod,v 1.16 2003/01/27 02:13:26 nilsson Exp $ +// $Id: Decode.pmod,v 1.17 2003/01/27 02:46:27 nilsson Exp $ // #pike __REAL_VERSION__ @@ -96,7 +96,7 @@ class constructed //! @fixme //! Handling of implicit and explicit ASN.1 tagging, as well as //! other context dependence, is next to non_existant. -object der_decode(ADT.struct data, mapping(int:program(Object)) types) +Object der_decode(ADT.struct data, mapping(int:program(Object)) types) { int raw_tag = data->get_uint(1); int len; @@ -205,7 +205,7 @@ mapping(int:program(Object)) universal_types = //! an object from @[Standards.ASN1.Types] or //! either @[Standards.ASN1.Decode.primitive] or //! @[Standards.ASN1.Decode.constructed] if the type is unknown. -object|mapping simple_der_decode(string data) +Object simple_der_decode(string data) { return der_decode(ADT.struct(data), universal_types); } diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod index c98d5ff09501123506baf0b983265928e4761e93..db397a5018a3b3e759cc97dfea9f9aed43de1b74 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod @@ -1,5 +1,5 @@ // -// $Id: Types.pmod,v 1.25 2003/01/27 02:12:02 nilsson Exp $ +// $Id: Types.pmod,v 1.26 2003/01/27 02:46:27 nilsson Exp $ // //! Encodes various asn.1 objects according to the Distinguished @@ -84,10 +84,10 @@ class Object string der; // Should be overridden by subclasses - object decode_primitive(string contents); - object begin_decode_constructed(string raw); - object decode_constructed_element(int i, object e); - object end_decode_constructed(int length); + this_program decode_primitive(string contents); + this_program begin_decode_constructed(string raw); + this_program decode_constructed_element(int i, object e); + this_program end_decode_constructed(int length); mapping(int:program(Object)) element_types(int i, mapping(int:program(Object)) types) { diff --git a/lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod b/lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod index 1bfcd8601960668b12a5403571c5301404921912..edc021174cea909dc89a9b225ce6894d97716c2e 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod @@ -1,44 +1,42 @@ -/* CSR.pmod - * - * Handling of Certifikate Signing Requests (PKCS-10) - */ +// +// $Id: CSR.pmod,v 1.9 2003/01/27 02:54:02 nilsson Exp $ -#pike __REAL_VERSION__ +//! Handling of Certifikate Signing Requests (PKCS-10) -#if __VERSION__ >= 0.6 -import "."; -#endif /* __VERSION__ >= 0.6 */ +#pike __REAL_VERSION__ +// #pragma strict_types -#if constant(Standards.ASN1.Types.asn1_identifier) +#if constant(Standards.ASN1.Types.Identifier) import Standards.ASN1.Types; class CSR_Attributes { - inherit Certificate.Attributes; + inherit .Certificate.Attributes; constant cls = 2; constant tag = 0; } -object build_csr(object rsa, object name, +//! +Sequence build_csr(Crypto.rsa rsa, object name, mapping(string:array(object)) attributes) { - object info = asn1_sequence( ({ asn1_integer(0), name, - RSA.build_rsa_public_key(rsa), - CSR_Attributes(Identifiers.attribute_ids, - attributes) }) ); - return asn1_sequence( ({ info, - asn1_sequence( - ({ Identifiers.rsa_md5_id, asn1_null() }) ), - asn1_bit_string(rsa->sign(info->get_der(), - Crypto.md5) - ->digits(256)) }) ); + Sequence info = Sequence( ({ Integer(0), name, + .RSA.build_rsa_public_key(rsa), + CSR_Attributes(.Identifiers.attribute_ids, + attributes) }) ); + return Sequence( ({ info, + Sequence( + ({ .Identifiers.rsa_md5_id, Null() }) ), + BitString(rsa->sign(info->get_der(), + Crypto.md5) + ->digits(256)) }) ); } #if 0 object build_csr_dsa(object dsa, object name) { - object info = asn1_sequence( ({ asn1_integer }) ); + Sequence info = Sequence( ({ Integer }) ); } #endif diff --git a/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod b/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod index 4c4f93681753598bebafb25fb43c4f4671bb0e34..b6aa1875595b6cb04e7a754210b5febbb095f91d 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod @@ -1,4 +1,4 @@ -// $Id: Certificate.pmod,v 1.11 2002/11/27 16:49:08 grubba Exp $ +// $Id: Certificate.pmod,v 1.12 2003/01/27 02:54:02 nilsson Exp $ //! Handle PKCS-6 and PKCS-10 certificates and certificate requests. @@ -16,11 +16,11 @@ Version ::= INTEGER Attributes ::= SET OF Attribute --- From the last section of PKCS-9. +-- From the last section of PKCS-9. Attribute ::= SEQUENCE { attribyteType ::= OBJECT IDENTIFIER, attributeValue ::= SET OF ANY } - + CertificationRequest ::= SEQUENCE { certificationRequestInfo CertificationRequestInfo, signatureAlgorithm SignatureAlgorithmIdentifier, @@ -124,26 +124,20 @@ Version ::= INTEGER */ -#if __VERSION__ >= 0.6 -import "."; -#endif /* __VERSION__ >= 0.6 */ - -#if constant(Standards.ASN1.Types.asn1_sequence) +#if constant(Standards.ASN1.Types.Sequence) import Standards.ASN1.Types; -import Identifiers; +import .Identifiers; class AttributeValueAssertion { - import Standards.ASN1.Types; - inherit asn1_sequence; + inherit Sequence; void create(mapping(string:object) types, string type, object value) { if (!types[type]) - error( "AttributeValueAssertion: " - "Unknown attribute type '%s'\n", type ); + error( "Unknown attribute type '%s'\n", type ); ::create( ({ types[type], value }) ); } } @@ -151,56 +145,51 @@ class AttributeValueAssertion /* RelativeDistinguishedName */ class attribute_set { - import Standards.ASN1.Types; - inherit asn1_set; + inherit Set; void create(mapping(string:object) types, mapping(string:object) pairs) - { - ::create(Array.map(indices(pairs), - lambda(string s, mapping m, mapping t) - { - return AttributeValueAssertion(t, s, m[s]); - }, - pairs, types)); - } + { + ::create(map(indices(pairs), + lambda(string s, mapping m, mapping t) { + return AttributeValueAssertion(t, s, m[s]); + }, + pairs, types)); + } } -object build_distinguished_name(mapping(string:object) ... args) +//! +Sequence build_distinguished_name(mapping(string:object) ... args) { - return asn1_sequence(Array.map(args, lambda(mapping rdn) - { - return attribute_set( - Identifiers.at_ids, rdn); - } )); + return Sequence(map(args, lambda(mapping rdn) { + return attribute_set( + .Identifiers.at_ids, rdn); + } )); } class Attribute { - import Standards.ASN1.Types; - inherit asn1_sequence; + inherit Sequence; void create(mapping(string:object) types, string type, array(object) v) - { - if (!types[type]) - error( "Attribute: Unknown attribute type '%s'\n", type); - ::create( ({ types[type], asn1_set(v) }) ); - } + { + if (!types[type]) + error( "Unknown attribute type '%s'\n", type); + ::create( ({ types[type], Set(v) }) ); + } } class Attributes { - import Standards.ASN1.Types; - inherit asn1_set; + inherit Set; void create(mapping(string:object) types, mapping(string:array(object)) m) - { - ::create(Array.map(indices(m), - lambda(string field, mapping m, mapping t) - { - return Attribute(t, field, m[field]); - }, m, types)); - } + { + ::create(map(indices(m), + lambda(string field, mapping m, mapping t) { + return Attribute(t, field, m[field]); + }, m, types)); + } } - + #endif diff --git a/lib/modules/Standards.pmod/PKCS.pmod/DSA.pmod b/lib/modules/Standards.pmod/PKCS.pmod/DSA.pmod index 6c4861a90876da7e9db9387f6b072cbac5443a0c..70d9c328d51002b8c38712208bb65f0b1e3e3350 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/DSA.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/DSA.pmod @@ -1,58 +1,60 @@ -/* DSA.pmod - * - * DSA operations as defined in RFC-2459. - * - */ +// +// $Id: DSA.pmod,v 1.6 2003/01/27 02:54:02 nilsson Exp $ +// + +//! DSA operations as defined in RFC-2459. /* NOTE: Unlike the functions in RSA.pmod, this function returns * an object rather than a string. */ #pike __REAL_VERSION__ - +// #pragma strict_types #if constant(Gmp.mpz) -constant asn1_sequence = Standards.ASN1.Types.asn1_sequence; -constant asn1_integer = Standards.ASN1.Types.asn1_integer; +import Standards.ASN1.Types; -object algorithm_identifier(object|void dsa) +//! +Sequence algorithm_identifier(Crypto.dsa|void dsa) { return - dsa ? asn1_sequence( ({ .Identifiers.dsa_id, - asn1_sequence( ({ asn1_integer(dsa->p), - asn1_integer(dsa->q), - asn1_integer(dsa->g) }) ) }) ) - : asn1_sequence( ({ .Identifiers.dsa_id }) ); + dsa ? Sequence( ({ .Identifiers.dsa_id, + Sequence( ({ Integer(dsa->p), + Integer(dsa->q), + Integer(dsa->g) }) ) }) ) + : Sequence( ({ .Identifiers.dsa_id }) ); } -string public_key(object dsa) +//! +string public_key(Crypto.dsa dsa) { - return asn1_integer(dsa->y)->get_der(); + return Integer(dsa->y)->get_der(); } /* I don't know if this format interoperates with anything else */ -string private_key(object dsa) +//! +string private_key(Crypto.dsa dsa) { - return asn1_sequence(Array.map( - ({ dsa->p, dsa->q, dsa->g, dsa->y, dsa->x }), - asn1_integer))->get_der(); + return Sequence(map( ({ dsa->p, dsa->q, dsa->g, dsa->y, dsa->x }), + Integer))->get_der(); } -object parse_private_key(string key) +//! +Crypto.dsa parse_private_key(string key) { - object a = Standards.ASN1.Decode.simple_der_decode(key); + Object a = Standards.ASN1.Decode.simple_der_decode(key); - if (!a - || (a->type_name != "SEQUENCE") - || (sizeof(a->elements) != 5) - || (sizeof(a->elements->type_name - ({ "INTEGER" }))) ) - return 0; + if (!a + || (a->type_name != "SEQUENCE") + || (sizeof(a->elements) != 5) + || (sizeof(a->elements->type_name - ({ "INTEGER" }))) ) + return 0; - object dsa = Crypto.dsa(); - dsa->set_public_key(@ a->elements[..3]->value); - dsa->set_private_key(a->elements[4]->value); + Crypto.dsa dsa = Crypto.dsa(); + dsa->set_public_key(@ a->elements[..3]->value); + dsa->set_private_key(a->elements[4]->value); - return dsa; + return dsa; } #endif diff --git a/lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod b/lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod index 22df46029309f2ba139c0bec246108654cc21afc..cadc2bbe65f96e3c7bbc60e08d4ade7fd737372c 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod @@ -1,8 +1,9 @@ -#pike __REAL_VERSION__ +// +// $Id: Identifiers.pmod,v 1.11 2003/01/27 02:54:02 nilsson Exp $ +// Object identifiers -/* identifiers.pmod - * - * Object identifiers */ +#pike __REAL_VERSION__ +#pragma strict_types /* Attributes (from http://leangen.uninett.no:29659/~hta/ietf/oid/2.5.4.html): (by 1999-01-25, a better URL is http://www.alvestrand.no/objectid/top.html) @@ -64,63 +65,60 @@ 2.5.4.53 - id-at-deltaRevocationList */ -#if constant(Standards.ASN1.Types.asn1_identifier) +#if constant(Standards.ASN1.Types.Identifier) import Standards.ASN1.Types; -object pkcs_id = asn1_identifier(1, 2, 840, 113549, 1); -object pkcs_1_id = pkcs_id->append(1); -object pkcs_9_id = pkcs_id->append(9); +Identifier pkcs_id = Identifier(1, 2, 840, 113549, 1); +Identifier pkcs_1_id = pkcs_id->append(1); +Identifier pkcs_9_id = pkcs_id->append(9); /* For public key */ -object rsa_id = pkcs_1_id->append(1); +Identifier rsa_id = pkcs_1_id->append(1); /* Signature algorithms */ -object rsa_md2_id = pkcs_1_id->append(2); -object rsa_md5_id = pkcs_1_id->append(4); -object rsa_sha1_id = pkcs_1_id->append(5); +Identifier rsa_md2_id = pkcs_1_id->append(2); +Identifier rsa_md5_id = pkcs_1_id->append(4); +Identifier rsa_sha1_id = pkcs_1_id->append(5); /* For public key id-dsa ID ::= { iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 1 } */ -object dsa_id = asn1_identifier(1, 2, 840, 10040, 4, 1); +Identifier dsa_id = Identifier(1, 2, 840, 10040, 4, 1); /* Signature algorithm id-dsa-with-sha1 ID ::= { iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } */ -object dsa_sha_id = asn1_identifier(1, 2, 840, 10040, 4, 3); +Identifier dsa_sha_id = Identifier(1, 2, 840, 10040, 4, 3); -object md2_id = asn1_identifier(1, 2, 840, 113549, 2, 2); -object md5_id = asn1_identifier(1, 2, 840, 113549, 2, 5); -object sha1_id = asn1_identifier(1, 3, 14, 3, 2, 26); +Identifier md2_id = Identifier(1, 2, 840, 113549, 2, 2); +Identifier md5_id = Identifier(1, 2, 840, 113549, 2, 5); +Identifier sha1_id = Identifier(1, 3, 14, 3, 2, 26); /* dhpublicnumber OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) ansi-x942(10046) number-type(2) 1 } */ -object dh_id = asn1_identifier(1, 2, 840, 10046, 2, 1); +Identifier dh_id = Identifier(1, 2, 840, 10046, 2, 1); /* Object Identifiers used in X509 distinguished names */ -object at_id = asn1_identifier(2, 5, 4); - -/* Kept for compatibility with older versions of this file. */ -object attributeType_id = at_id; +Identifier at_id = Identifier(2, 5, 4); -mapping name_ids = +mapping(string:Identifier) name_ids = ([ /* layman.asc says "commonUnitName". Typo? */ - "commonName" : attributeType_id->append(3), /* printable string */ - "countryName" : attributeType_id->append(6), /* printable string */ - "localityName" : attributeType_id->append(7), /* printable string */ - "stateOrProvinceName" : attributeType_id->append(8), /* printable string */ - "organizationName" : attributeType_id->append(10), /* printable string */ - "organizationUnitName" : attributeType_id->append(11) /* printable string */ + "commonName" : at_id->append(3), /* printable string */ + "countryName" : at_id->append(6), /* printable string */ + "localityName" : at_id->append(7), /* printable string */ + "stateOrProvinceName" : at_id->append(8), /* printable string */ + "organizationName" : at_id->append(10), /* printable string */ + "organizationUnitName" : at_id->append(11) /* printable string */ ]); -mapping attribute_ids = +mapping(string:Identifier) attribute_ids = ([ "emailAddress" : pkcs_9_id->append(1), /* IA5String */ "unstructuredName" : pkcs_9_id->append(2), /* IA5String */ @@ -138,7 +136,7 @@ mapping attribute_ids = /* From RFC 2459 */ -mapping at_ids = +mapping(string:Identifier) at_ids = ([ /* All attribute values are a CHOICE of most string types, * including PrintableString, TeletexString (which in practice * means latin1) and UTF8String. */ @@ -160,11 +158,11 @@ mapping at_ids = "emailAddress" : pkcs_9_id->append(1) /* IA5String */ ]); -object ce_id = asn1_identifier(2, 5, 29); -object pkix_id = asn1_identifier(1, 3, 6, 1, 5, 5, 7); +Identifier ce_id = Identifier(2, 5, 29); +Identifier pkix_id = Identifier(1, 3, 6, 1, 5, 5, 7); -mapping ce_ids = +mapping(string:Identifier) ce_ids = ([ "subjectDirectoryAttributes" : ce_id->append(9), "subjectKeyIdentifier" : ce_id->append(14), @@ -183,17 +181,17 @@ mapping ce_ids = ]); /* Policy qualifiers */ -object qt_id = pkix_id->append(2); +Identifier qt_id = pkix_id->append(2); -mapping qt_ids = +mapping(string:Identifier) qt_ids = ([ "cps" : qt_id->append(1), "unotice" : qt_id->append(2) ]); /* Key purposes */ -object kp_id = pkix_id->append(3); +Identifier kp_id = pkix_id->append(3); -mapping kp_ids = +mapping(string:Identifier) kp_ids = ([ "serverAuth" : kp_id->append(1), "clientAuth" : kp_id->append(2), "codeSigning" : kp_id->append(3), @@ -201,13 +199,13 @@ mapping kp_ids = "timeStamping" : kp_id->append(8) ]); /* Private extensions */ -object pe_id = pkix_id->append(1); +Identifier pe_id = pkix_id->append(1); /* Access descriptions */ -object ad_id = pkix_id->append(48); +Identifier ad_id = pkix_id->append(48); -mapping ad_ids = +mapping(string:Identifier) ad_ids = ([ "caIssuers" : ad_id->append(2) ]); #endif diff --git a/lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod b/lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod index 78c2c8ceb6498ff0256368a6f1147a29dc1bfc77..397df29e4f59ac1df78dfe235e08a45a3df2f8b7 100644 --- a/lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod +++ b/lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod @@ -1,8 +1,9 @@ -// $Id: RSA.pmod,v 1.17 2002/11/27 16:31:21 nilsson Exp $ +// $Id: RSA.pmod,v 1.18 2003/01/27 02:54:02 nilsson Exp $ //! RSA operations and types as described in PKCS-1. #pike __REAL_VERSION__ +// #pragma strict_types #if 0 #define WERROR werror @@ -19,11 +20,10 @@ import Standards.ASN1.Types; //! @[Crypto.rsa] object //! @returns //! ASN1 coded RSAPublicKey structure -string public_key(object rsa) +string public_key(Crypto.rsa rsa) { - return asn1_sequence(Array.map( - ({ rsa->get_n(), rsa->get_e() }), - asn1_integer))->get_der(); + return Sequence(map( ({ rsa->get_n(), rsa->get_e() }), + Integer))->get_der(); } //! Create a DER-coded RSAPrivateKey structure @@ -31,50 +31,39 @@ string public_key(object rsa) //! @[Crypto.rsa] object //! @returns //! ASN1 coded RSAPrivateKey structure -string private_key(object rsa) +string private_key(Crypto.rsa rsa) { - object n = rsa->get_n(); - object e = rsa->get_e(); - object d = rsa->get_d(); - object p = rsa->get_p(); - object q = rsa->get_q(); + Gmp.mpz n = rsa->get_n(); + Gmp.mpz e = rsa->get_e(); + Gmp.mpz d = rsa->get_d(); + Gmp.mpz p = rsa->get_p(); + Gmp.mpz q = rsa->get_q(); - return asn1_sequence(Array.map( + return Sequence(map( ({ 0, n, e, d, p, q, d % (p - 1), d % (q - 1), q->invert(p) % p }), - asn1_integer))->get_der(); + Integer))->get_der(); } -/* Backwards compatibility */ -//! @deprecated public_key -string rsa_public_key(object rsa) { return public_key(rsa); } - -//! @deprecated private_key -string rsa_private_key(object rsa) { return private_key(rsa); } - //! Decode a DER-coded RSAPublicKey structure //! @param key //! RSAPublicKey provided in ASN1 encoded format //! @returns //! @[Crypto.rsa] object -object parse_public_key(string key) +Crypto.rsa parse_public_key(string key) { - // WERROR(sprintf("rsa->parse_public_key: '%s'\n", key)); - object a = Standards.ASN1.Decode.simple_der_decode(key); + Object a = Standards.ASN1.Decode.simple_der_decode(key); - // WERROR(sprintf("rsa->parse_public_key: asn1 = %O\n", a)); if (!a || (a->type_name != "SEQUENCE") || (sizeof(a->elements) != 2) || (sizeof(a->elements->type_name - ({ "INTEGER" }))) ) - { - // WERROR("Not a Valid Key!\n"); return 0; - } - object rsa = Crypto.rsa(); + + Crypto.rsa rsa = Crypto.rsa(); rsa->set_public_key(a->elements[0]->value, a->elements[1]->value); return rsa; } @@ -84,10 +73,10 @@ object parse_public_key(string key) //! RSAPrivateKey provided in ASN1 encoded format //! @returns //! @[Crypto.rsa] object -object parse_private_key(string key) +Crypto.rsa parse_private_key(string key) { WERROR(sprintf("rsa->parse_private_key: '%s'\n", key)); - object a = Standards.ASN1.Decode.simple_der_decode(key); + Object a = Standards.ASN1.Decode.simple_der_decode(key); WERROR(sprintf("rsa->parse_private_key: asn1 = %O\n", a)); if (!a @@ -97,19 +86,19 @@ object parse_private_key(string key) || a->elements[0]->value) return 0; - object rsa = Crypto.rsa(); + Crypto.rsa rsa = Crypto.rsa(); rsa->set_public_key(a->elements[1]->value, a->elements[2]->value); rsa->set_private_key(a->elements[3]->value, a->elements[4..]->value); return rsa; } -object build_rsa_public_key(object rsa) +Sequence build_rsa_public_key(object rsa) { - return asn1_sequence( ({ - asn1_sequence( - ({ .Identifiers.rsa_id, asn1_null() }) ), - asn1_bit_string(asn1_sequence( - ({ asn1_integer(rsa->n), asn1_integer(rsa->e) }) )->get_der()) }) ); + return Sequence( ({ + Sequence( + ({ .Identifiers.rsa_id, Null() }) ), + BitString(Sequence( + ({ Integer(rsa->n), Integer(rsa->e) }) )->get_der()) }) ); } #endif