diff options
author | Jack Lloyd <[email protected]> | 2017-10-02 22:20:13 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-02 22:45:20 -0400 |
commit | d543843c8da753c0b7fa60f378c7c16294aaf982 (patch) | |
tree | b2f47a4d0b26d097c6b9e78f42aeb25905fa9ba4 /src/lib/prov/pkcs11/p11_ecc_key.cpp | |
parent | 114754ec4cca71e3dce6d39ea2e3c94e0fec70cb (diff) |
Remove protected m_handle data from PKCS11::Object
Diffstat (limited to 'src/lib/prov/pkcs11/p11_ecc_key.cpp')
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecc_key.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/prov/pkcs11/p11_ecc_key.cpp b/src/lib/prov/pkcs11/p11_ecc_key.cpp index 9366594a6..df55b9ffb 100644 --- a/src/lib/prov/pkcs11/p11_ecc_key.cpp +++ b/src/lib/prov/pkcs11/p11_ecc_key.cpp @@ -90,12 +90,14 @@ PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<u pub_key_props.set_private(false); pub_key_props.set_token(false); // don't create a persistent public key object - ObjectHandle pub_key_handle = 0; - m_handle = 0; + ObjectHandle pub_key_handle = CK_INVALID_HANDLE; + ObjectHandle priv_key_handle = CK_INVALID_HANDLE; Mechanism mechanism = { CKM_EC_KEY_PAIR_GEN, nullptr, 0 }; session.module()->C_GenerateKeyPair(session.handle(), &mechanism, pub_key_props.data(), pub_key_props.count(), props.data(), props.count(), - &pub_key_handle, &m_handle); + &pub_key_handle, &priv_key_handle); + + this->reset_handle(priv_key_handle); Object public_key(session, pub_key_handle); m_public_key = decode_public_point(public_key.get_attribute_value(AttributeType::EcPoint), m_domain_params.get_curve()); |