aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-24 14:19:16 +0200
committerMartin Willi <martin@strongswan.org>2009-08-26 11:23:52 +0200
commit5bceb90c8660d7e6f33b1c9d3996d836918945e3 (patch)
tree9f5efd5d00fe91e0a4f8889c3d6945ec161a6443 /src
parent8d09681559f4e4745b26a18f303fe0963e0c4f43 (diff)
downloadstrongswan-5bceb90c8660d7e6f33b1c9d3996d836918945e3.tar.bz2
strongswan-5bceb90c8660d7e6f33b1c9d3996d836918945e3.tar.xz
updated scepclient to new encoding API
Diffstat (limited to 'src')
-rw-r--r--src/scepclient/pkcs10.c8
-rw-r--r--src/scepclient/scep.c8
-rw-r--r--src/scepclient/scepclient.c5
3 files changed, 11 insertions, 10 deletions
diff --git a/src/scepclient/pkcs10.c b/src/scepclient/pkcs10.c
index cdd68431e..b0de006b5 100644
--- a/src/scepclient/pkcs10.c
+++ b/src/scepclient/pkcs10.c
@@ -157,11 +157,13 @@ build_req_info_attributes(pkcs10_t* pkcs10)
static chunk_t
pkcs10_build_request(pkcs10_t *pkcs10, int signature_alg)
{
- chunk_t key = pkcs10->public_key->get_encoding(pkcs10->public_key);
-
+ chunk_t key = chunk_empty;
+
+ pkcs10->public_key->get_encoding(pkcs10->public_key, KEY_PUB_ASN1_DER, &key);
+
chunk_t keyInfo = asn1_wrap(ASN1_SEQUENCE, "cm",
asn1_algorithmIdentifier(OID_RSA_ENCRYPTION),
- asn1_bitstring("m", key));
+ asn1_bitstring("m", key));
chunk_t cert_req_info = asn1_wrap(ASN1_SEQUENCE, "ccmm",
ASN1_INTEGER_0,
diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c
index a788c6f41..f3e978ff3 100644
--- a/src/scepclient/scep.c
+++ b/src/scepclient/scep.c
@@ -287,16 +287,16 @@ void scep_generate_transaction_id(public_key_t *key, chunk_t *transID,
{
char digest_buf[HASH_SIZE_MD5];
chunk_t digest = chunk_from_buf(digest_buf);
- chunk_t keyEncoding, keyInfo;
+ chunk_t keyEncoding = chunk_empty, keyInfo;
hasher_t *hasher;
bool msb_set;
u_char *pos;
- keyEncoding = key->get_encoding(key);
-
+ key->get_encoding(key, KEY_PUB_ASN1_DER, &keyEncoding);
+
keyInfo = asn1_wrap(ASN1_SEQUENCE, "cm",
asn1_algorithmIdentifier(OID_RSA_ENCRYPTION),
- asn1_bitstring("m", keyEncoding));
+ asn1_bitstring("m", keyEncoding));
hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5);
hasher->get_hash(hasher, keyInfo, digest_buf);
diff --git a/src/scepclient/scepclient.c b/src/scepclient/scepclient.c
index 6c0166d66..ca6b07065 100644
--- a/src/scepclient/scepclient.c
+++ b/src/scepclient/scepclient.c
@@ -896,9 +896,8 @@ int main(int argc, char **argv)
DBG(DBG_CONTROL,
DBG_log("building pkcs1 object:")
)
- pkcs1 = private_key->get_encoding(private_key);
-
- if (!chunk_write(pkcs1, path, "pkcs1", 0066, force))
+ if (!private_key->get_encoding(private_key, KEY_PRIV_ASN1_DER, &pkcs1) ||
+ !chunk_write(pkcs1, path, "pkcs1", 0066, force))
exit_scepclient("could not write pkcs1 file '%s'", path);
filetype_out &= ~PKCS1; /* delete PKCS1 flag */