Differences From Artifact [cf76aee3de]:
- File asn1-x509.c — part of check-in [f89918d4df] at 2010-05-14 20:49:59 on branch trunk — Added function to convert X.509 DN to string representation (user: rkeene, size: 6960) [annotate] [blame] [check-ins using]
To 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]
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + + + + + | struct asn1_object certificate; struct asn1_object version; struct asn1_object serial_number; struct asn1_object signature_algo; struct asn1_object issuer; struct asn1_object validity; struct asn1_object subject; |
︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | + + + + + | outbuf->tag = *buf_p; buf_p++; buflen--; if (buflen == 0) { return(-1); } /* NULL Tag -- no size is required */ if (outbuf->tag == 0x00) { return(_asn1_x509_read_asn1_object(buf_p, buflen, args)); } small_object_size = *buf_p; buf_p++; buflen--; if (buflen == 0) { return(-1); } |
︙ | |||
130 131 132 133 134 135 136 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + + + + + + | } read_ret = asn1_x509_read_asn1_object(outbuf->wholething.contents, outbuf->wholething.size, &outbuf->certificate, NULL); if (read_ret != 0) { return(-1); } |
︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + | if (outbuf) { *outbuf = x509.serial_number.asn1rep; } return(x509.serial_number.asn1rep_len); } 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); 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); } return(modulus.size - 1); } /* * http://www.blackberry.com/developers/docs/4.6.0api/javax/microedition/pki/Certificate.html */ static const char *_x509_objectid_to_label_string(void *buf, size_t buflen) { switch (buflen) { case 3: |
︙ |