diff options
author | Martin Willi <martin@strongswan.org> | 2006-05-19 06:44:08 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-05-19 06:44:08 +0000 |
commit | 86a7937b45b624867af996e30642d6be70f37988 (patch) | |
tree | 3a4aa31ae4c7e54d1757d64f63823b20516a6890 /src/libstrongswan/crypto/rsa/rsa_public_key.c | |
parent | 3e61d63a3a468586b89a5dcf0d6579a58ad5009e (diff) | |
download | strongswan-86a7937b45b624867af996e30642d6be70f37988.tar.bz2 strongswan-86a7937b45b624867af996e30642d6be70f37988.tar.xz |
- applied patch from andreas, which allows certificate listing via stroke
Diffstat (limited to 'src/libstrongswan/crypto/rsa/rsa_public_key.c')
-rw-r--r-- | src/libstrongswan/crypto/rsa/rsa_public_key.c | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/src/libstrongswan/crypto/rsa/rsa_public_key.c b/src/libstrongswan/crypto/rsa/rsa_public_key.c index 2f8c6fd8f..8fd02d2ef 100644 --- a/src/libstrongswan/crypto/rsa/rsa_public_key.c +++ b/src/libstrongswan/crypto/rsa/rsa_public_key.c @@ -40,39 +40,58 @@ * TODO: We may move them in asn1 sometime... */ -u_int8_t md2_oid[] = { - 0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86, - 0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00, - 0x04,0x10 +const u_int8_t md2_oid[] = { + 0x30,0x20, + 0x30,0x0c, + 0x06,0x08, + 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02, + 0x05,0x00, + 0x04,0x10 }; -u_int8_t md5_oid[] = { - 0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86, - 0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00, - 0x04,0x10 +const u_int8_t md5_oid[] = { + 0x30,0x20, + 0x30,0x0c, + 0x06,0x08, + 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05, + 0x05,0x00, + 0x04,0x10 }; -u_int8_t sha1_oid[] = { - 0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e, - 0x03,0x02,0x1a,0x05,0x00,0x04,0x14 +const u_int8_t sha1_oid[] = { + 0x30,0x21, + 0x30,0x09, + 0x06,0x05, + 0x2b,0x0e,0x03,0x02,0x1a, + 0x05,0x00, + 0x04,0x14 }; -u_int8_t sha256_oid[] = { - 0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86, - 0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05, - 0x00,0x04,0x20 +const u_int8_t sha256_oid[] = { + 0x30,0x31, + 0x30,0x0d, + 0x06,0x09, + 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01, + 0x05,0x00, + 0x04,0x20 }; -u_int8_t sha384_oid[] = { - 0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86, - 0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05, - 0x00,0x04,0x30 +const u_int8_t sha384_oid[] = { + 0x30,0x41, + 0x30,0x0d, + 0x06,0x09, + 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02, + 0x05,0x00, + 0x04,0x30 }; -u_int8_t sha512_oid[] = { - 0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86, - 0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05, - 0x00,0x04,0x40 +const u_int8_t sha512_oid[] = { + 0x30,0x51, + 0x30,0x0d, + 0x06,0x09, + 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03, + 0x05,0x00, + 0x04,0x40 }; /* ASN.1 definition public key */ @@ -338,6 +357,14 @@ static mpz_t *get_modulus(private_rsa_public_key_t *this) } /** + * Implementation of rsa_public_key.get_keysize. + */ +static size_t get_keysize(private_rsa_public_key_t *this) +{ + return this->k; +} + +/** * Implementation of rsa_public_key.clone. */ static rsa_public_key_t* _clone(private_rsa_public_key_t *this) @@ -373,6 +400,7 @@ private_rsa_public_key_t *rsa_public_key_create_empty(void) this->public.get_key = (status_t (*) (rsa_public_key_t*,chunk_t*))get_key; this->public.save_key = (status_t (*) (rsa_public_key_t*,char*))save_key; this->public.get_modulus = (mpz_t *(*) (rsa_public_key_t*))get_modulus; + this->public.get_keysize = (size_t (*) (rsa_public_key_t*))get_keysize; this->public.clone = (rsa_public_key_t* (*) (rsa_public_key_t*))_clone; this->public.destroy = (void (*) (rsa_public_key_t*))destroy; |