diff options
author | Tobias Brunner <tobias@strongswan.org> | 2011-11-02 19:11:46 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2011-11-02 20:27:55 +0100 |
commit | 30a3ede8cee48adb16ef73c9eddda1b7418d263f (patch) | |
tree | 82c67d87cbb427820e105db0c799634f6f78d997 /src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c | |
parent | 5d2fccf439de73d2e778beb2c1c43b8034019b72 (diff) | |
download | strongswan-30a3ede8cee48adb16ef73c9eddda1b7418d263f.tar.bz2 strongswan-30a3ede8cee48adb16ef73c9eddda1b7418d263f.tar.xz |
pkcs11: Lookup the public key of a private key by CKA_ID.
Currently this only works if a public key object with the same ID is
available, if there isn't one we could search for a certificate with the
same ID and extract the key from there.
Diffstat (limited to 'src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c')
-rw-r--r-- | src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c index fd50d0287..fda6ae392 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.c @@ -81,6 +81,13 @@ struct private_pkcs11_private_key_t { key_type_t type; }; +/** + * Implemented in pkcs11_public_key.c + */ +public_key_t *pkcs11_public_key_connect(pkcs11_library_t *p11, + int slot, key_type_t type, chunk_t keyid); + + METHOD(private_key_t, get_type, key_type_t, private_pkcs11_private_key_t *this) { @@ -613,6 +620,8 @@ pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args) return NULL; } + this->pubkey = pkcs11_public_key_connect(this->lib, slot, this->type, + keyid); if (!this->pubkey) { destroy(this); |