Differences From Artifact [d808ad3525]:
- File
asn1-x509.c
— part of check-in
[a2ac84031e]
at
2010-05-17 19:37:43
on branch trunk
— Updated to support determining key size from X.509 object (untested)
Updated to set HW TOKEN flag
Updated to pad sign/decrypt message to key size (untested) (user: rkeene, size: 8088) [annotate] [blame] [check-ins using]
To Artifact [b4f2f9070a]:
- File
asn1-x509.c
— part of check-in
[ef50f6c143]
at
2010-05-20 23:45:53
on branch trunk
— Corrected unpadding
Changed label to be generated, rather than derived from card
Added support for reading the modulus and exponent from an X.509 certificate
Added additional attributes (user: rkeene, size: 9503) [annotate] [blame] [check-ins using]
︙ | |||
199 200 201 202 203 204 205 206 207 208 209 210 211 212 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if (outbuf) { *outbuf = x509.serial_number.asn1rep; } return(x509.serial_number.asn1rep_len); } ssize_t x509_to_modulus(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf) { struct asn1_object null, pubkey, modulus, exponent; struct x509_object x509; int read_ret; read_ret = asn1_x509_read_object(x509_der_buf, x509_der_buf_len, &x509); if (read_ret != 0) { return(-1); } /* The structure of "pubkey" is specified in PKCS #1 */ read_ret = asn1_x509_read_asn1_object(x509.pubkey.contents, x509.pubkey.size, &null, &pubkey, NULL); if (read_ret != 0) { return(-1); } read_ret = asn1_x509_read_asn1_object(pubkey.contents, pubkey.size, &modulus, &exponent, NULL); if (read_ret != 0) { return(-1); } if (outbuf) { *outbuf = modulus.contents; } return(modulus.size); } ssize_t x509_to_exponent(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf) { struct asn1_object null, pubkey, modulus, exponent; struct x509_object x509; int read_ret; read_ret = asn1_x509_read_object(x509_der_buf, x509_der_buf_len, &x509); if (read_ret != 0) { return(-1); } /* The structure of "pubkey" is specified in PKCS #1 */ read_ret = asn1_x509_read_asn1_object(x509.pubkey.contents, x509.pubkey.size, &null, &pubkey, NULL); if (read_ret != 0) { return(-1); } read_ret = asn1_x509_read_asn1_object(pubkey.contents, pubkey.size, &modulus, &exponent, NULL); if (read_ret != 0) { return(-1); } if (outbuf) { *outbuf = exponent.contents; } return(exponent.size); } ssize_t x509_to_keysize(void *x509_der_buf, size_t x509_der_buf_len) { struct asn1_object null, pubkey, modulus, exponent; struct x509_object x509; int read_ret; read_ret = asn1_x509_read_object(x509_der_buf, x509_der_buf_len, &x509); |
︙ |