Check-in [30d36fdd77]
Overview
Comment:Added support for CKO_PUBLIC_KEY objects
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:30d36fdd77e9842d711d21e296ba61cf2c2e3fbe
User & Date: rkeene on 2012-05-09 16:22:06
Other Links: manifest | tags
Context
2012-05-09
16:37
Removed spurious variables check-in: cfd166f381 user: rkeene tags: trunk
16:22
Added support for CKO_PUBLIC_KEY objects check-in: 30d36fdd77 user: rkeene tags: trunk
2012-04-26
01:53
CACKey 0.6.6 check-in: db27c32333 user: rkeene tags: trunk, 0.6.6
Changes

Modified asn1-x509.c from [d088e178d2] to [4068b9a871].

   199    199   
   200    200   	if (outbuf) {
   201    201   		*outbuf = x509.serial_number.asn1rep;
   202    202   	}
   203    203   
   204    204   	return(x509.serial_number.asn1rep_len);
   205    205   }
          206  +
          207  +static ssize_t x509_to_pubkey(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf) {
          208  +	struct asn1_object null, pubkey, modulus, exponent;
          209  +	struct x509_object x509;
          210  +	int read_ret;
          211  +
          212  +	read_ret = asn1_x509_read_object(x509_der_buf, x509_der_buf_len, &x509);
          213  +	if (read_ret != 0) {
          214  +		return(-1);
          215  +	}
          216  +
          217  +	*outbuf = x509.pubkey.contents;
          218  +	return(x509.pubkey.size);
          219  +}
   206    220   
   207    221   static ssize_t x509_to_modulus(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf) {
   208    222   	struct asn1_object null, pubkey, modulus, exponent;
   209    223   	struct x509_object x509;
   210    224   	int read_ret;
   211    225   
   212    226   	read_ret = asn1_x509_read_object(x509_der_buf, x509_der_buf_len, &x509);

Modified asn1-x509.h from [69520a462e] to [b2869862b9].

    11     11   #endif
    12     12   
    13     13   static ssize_t x509_to_subject(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
    14     14   
    15     15   static ssize_t x509_to_issuer(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
    16     16   
    17     17   static ssize_t x509_to_serial(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
           18  +
           19  +static ssize_t x509_to_pubkey(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
    18     20   
    19     21   static ssize_t x509_to_modulus(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
    20     22   
    21     23   static ssize_t x509_to_exponent(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);
    22     24   
    23     25   static ssize_t x509_to_keysize(void *x509_der_buf, size_t x509_der_buf_len);
    24     26   
    25     27   static ssize_t x509_dn_to_string(void *asn1_der_buf, size_t asn1_der_buf_len, char *outbuf, size_t outbuf_len, char *matchlabel);
    26     28   
    27     29   #endif

Modified cackey.c from [6206331092] to [5510d07f5c].

  2822   2822   
  2823   2823   						break;
  2824   2824   					case CKO_NETSCAPE_TRUST:
  2825   2825   						CACKEY_DEBUG_PRINTF(" ... but not getting it because we are a Netscape trust object");
  2826   2826   
  2827   2827   						break;
  2828   2828   					case CKO_PUBLIC_KEY:
  2829         -						/* XXX: TODO */
         2829  +						if (certificate_len >= 0) {
         2830  +							x509_read_ret = x509_to_pubkey(certificate, certificate_len, &pValue);
         2831  +							if (x509_read_ret < 0) { 
         2832  +								pValue = NULL;
         2833  +							} else {
         2834  +								ulValueLen = x509_read_ret;
         2835  +							}
         2836  +						}
  2830   2837   
  2831   2838   						break;
  2832   2839   					case CKO_CERTIFICATE:
  2833   2840   						pValue = certificate;
  2834   2841   						ulValueLen = certificate_len;
  2835   2842   
  2836   2843   						break;