aboutsummaryrefslogtreecommitdiffstats
path: root/src/medsrv/controller/peer_controller.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-25 15:37:33 +0200
committerMartin Willi <martin@strongswan.org>2009-08-26 11:23:55 +0200
commit9c3d2b3d60a1616813ccc88bbc036c983d0733b4 (patch)
tree059c00945314807eee1bb80bdf4064d7dedc9245 /src/medsrv/controller/peer_controller.c
parent1cd0d7969ab8a1b4bfff70d4b4deeaa514995a76 (diff)
downloadstrongswan-9c3d2b3d60a1616813ccc88bbc036c983d0733b4.tar.bz2
strongswan-9c3d2b3d60a1616813ccc88bbc036c983d0733b4.tar.xz
updated medsrv and test to new fingerprint/encoding API
Diffstat (limited to 'src/medsrv/controller/peer_controller.c')
-rwxr-xr-xsrc/medsrv/controller/peer_controller.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/medsrv/controller/peer_controller.c b/src/medsrv/controller/peer_controller.c
index 5166a420c..9b472a903 100755
--- a/src/medsrv/controller/peer_controller.c
+++ b/src/medsrv/controller/peer_controller.c
@@ -121,8 +121,7 @@ static bool parse_public_key(private_peer_controller_t *this,
chunk_t *encoding, chunk_t *keyid)
{
public_key_t *public;
- identification_t *id;
- chunk_t blob;
+ chunk_t blob, id;
if (!public_key || *public_key == '\0')
{
@@ -140,11 +139,16 @@ static bool parse_public_key(private_peer_controller_t *this,
return FALSE;
}
/* TODO: use get_encoding() with an encoding type */
+ if (!public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &id) ||
+ !public->get_encoding(public, KEY_PUB_ASN1_DER, &blob))
+ {
+ request->setf(request, "error=Encoding public key failed.");
+ return FALSE;
+ }
+ *keyid = chunk_clone(id);
*encoding = asn1_wrap(ASN1_SEQUENCE, "cm",
asn1_algorithmIdentifier(OID_RSA_ENCRYPTION),
- asn1_bitstring("m", public->get_encoding(public)));
- id = public->get_id(public, ID_PUBKEY_SHA1);
- *keyid = chunk_clone(id->get_encoding(id));
+ asn1_bitstring("m", blob));
public->destroy(public);
return TRUE;
}