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
200
201
202
203
204
205














206
207
208
209
210
211
212

	if (outbuf) {
		*outbuf = x509.serial_number.asn1rep;
	}

	return(x509.serial_number.asn1rep_len);
}















static 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);







>
>
>
>
>
>
>
>
>
>
>
>
>
>







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

	if (outbuf) {
		*outbuf = x509.serial_number.asn1rep;
	}

	return(x509.serial_number.asn1rep_len);
}

static ssize_t x509_to_pubkey(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);
	}

	*outbuf = x509.pubkey.contents;
	return(x509.pubkey.size);
}

static 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);

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

11
12
13
14
15
16
17


18
19
20
21
22
23
24
25
26
27
#endif

static ssize_t x509_to_subject(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_issuer(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_serial(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);



static ssize_t x509_to_modulus(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_exponent(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_keysize(void *x509_der_buf, size_t x509_der_buf_len);

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);

#endif







>
>










11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#endif

static ssize_t x509_to_subject(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_issuer(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_serial(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_pubkey(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_modulus(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_exponent(void *x509_der_buf, size_t x509_der_buf_len, void **outbuf);

static ssize_t x509_to_keysize(void *x509_der_buf, size_t x509_der_buf_len);

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);

#endif

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

2822
2823
2824
2825
2826
2827
2828
2829







2830
2831
2832
2833
2834
2835
2836

						break;
					case CKO_NETSCAPE_TRUST:
						CACKEY_DEBUG_PRINTF(" ... but not getting it because we are a Netscape trust object");

						break;
					case CKO_PUBLIC_KEY:
						/* XXX: TODO */








						break;
					case CKO_CERTIFICATE:
						pValue = certificate;
						ulValueLen = certificate_len;

						break;







|
>
>
>
>
>
>
>







2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843

						break;
					case CKO_NETSCAPE_TRUST:
						CACKEY_DEBUG_PRINTF(" ... but not getting it because we are a Netscape trust object");

						break;
					case CKO_PUBLIC_KEY:
						if (certificate_len >= 0) {
							x509_read_ret = x509_to_pubkey(certificate, certificate_len, &pValue);
							if (x509_read_ret < 0) { 
								pValue = NULL;
							} else {
								ulValueLen = x509_read_ret;
							}
						}

						break;
					case CKO_CERTIFICATE:
						pValue = certificate;
						ulValueLen = certificate_len;

						break;