Skip to content
Snippets Groups Projects
Commit 2441e4b5 authored by Niels Möller's avatar Niels Möller
Browse files

Many small bug fixes.

Rev: lib/modules/Standards.pmod/PKCS.pmod/CSR.pmod:1.2
Rev: lib/modules/Standards.pmod/PKCS.pmod/Identifiers.pmod:1.2
Rev: lib/modules/Standards.pmod/PKCS.pmod/RSA.pmod:1.3
parent 3d449c4e
No related branches found
No related tags found
No related merge requests found
......@@ -3,26 +3,26 @@
* Handlig of Certifikate Signing Requests (PKCS-10)
*/
import asn1.encode;
import Standards.ASN1.Encode;
class Attributes
class CSR_Attributes
{
inherit certificate.attribute_set;
inherit Certificate.Attributes;
constant cls = 2;
constant tag = 0;
}
object build_csr(object rsafoo, object name,
mapping(string:object) attributes)
object build_csr(object rsa, object name,
mapping(string:array(object)) attributes)
{
object info = asn1_sequence(asn1_integer(0), name,
rsa.build_rsa_public_key(rsafoo),
Attributes(identifiers.attribute_ids,
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_bitstring(rsafoo->sign(info->der(), Crypto.md5)
Identifiers.rsa_md5_id, asn1_null()),
asn1_bitstring(rsa->sign(info->der(), Crypto.md5)
->digits(256)));
}
......
......@@ -61,7 +61,7 @@
2.5.4.53 - id-at-deltaRevocationList
*/
import asn1.encode;
import Standards.ASN1.Encode;
object pkcs_id = asn1_identifier(1, 2, 840, 113549, 1);
object pkcs_1_id = pkcs_id->append(1);
......@@ -80,7 +80,9 @@ mapping name_ids =
"commonName" : attributeType_id->append(3), /* printable string */
"countryName" : attributeType_id->append(6), /* printable string */
"localityName" : attributeType_id->append(7), /* printable string */
"organizationName" : attributeType_id->append(10) /* printable string */
"stateOrProvinceName" : attributeType_id->append(8), /* printable string */
"organizationName" : attributeType_id->append(10), /* printable string */
"organizationUnitName" : attributeType_id->append(11) /* printable string */
]);
mapping attribute_ids =
......@@ -94,5 +96,5 @@ mapping attribute_ids =
"challengePassword" : pkcs_9_id->append(7), /* Printable | T61
| Universal */
"unstructuredAddress" : pkcs_9_id->append(8), /* Printable | T61 */
"extendedCertificateAttributes" : pkcs_9_id->append(0) /* Attributes */
"extendedCertificateAttributes" : pkcs_9_id->append(9) /* Attributes */
]);
......@@ -8,7 +8,7 @@
#define WERROR(x)
#endif
import asn1.encode;
import Standards.ASN1.Encode;
/* Create a DER-coded RSAPrivateKey structure */
string rsa_private_key(object rsa)
......@@ -25,7 +25,7 @@ string rsa_private_key(object rsa)
object parse_private_key(string key)
{
WERROR(sprintf("rsa->parse_private_key: '%s'\n", key));
array a = asn1.decode(key)->get_asn1();
array a = Standards.ASN1.decode(key)->get_asn1();
WERROR(sprintf("rsa->parse_private_key: asn1 = %O\n", a));
if (!a
......@@ -49,7 +49,3 @@ object build_rsa_public_key(object rsa)
asn1_bitstring(asn1_sequence(
asn1_integer(rsa->n), asn1_integer(rsa->e))->der()));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment