diff options
author | Jack Lloyd <[email protected]> | 2016-11-04 10:51:30 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-04 10:51:30 -0400 |
commit | 19ac22af33d8e185d30e6c84299b8b86d7b0fa3f (patch) | |
tree | f1721fbf17621315544f9f85360c24c7bd515650 /src/lib/prov | |
parent | 0b820c330a62aaa3a715b7b7d00276f886cd4a0f (diff) |
Fix PKCS11 test error
Previously PKCS11_ECDSA_PrivateKey::check_key failed because no
verification is possible using this key type (does not derive from
public key). Split keypair consistency to allow two key arguments.
ECDSA keypair consistency disabled in the tests still, because
SoftHSMv2 gives mechanism invalid errors. I think this is a SoftHSMv2
issue with the signature mechanism.
Remove no longer used Key_Type typedefs (need to be removed everywhere).
GH #712
Diffstat (limited to 'src/lib/prov')
-rw-r--r-- | src/lib/prov/pkcs11/info.txt | 2 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdsa.cpp | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/prov/pkcs11/info.txt b/src/lib/prov/pkcs11/info.txt index 2715c7cda..e5a471b25 100644 --- a/src/lib/prov/pkcs11/info.txt +++ b/src/lib/prov/pkcs11/info.txt @@ -45,4 +45,4 @@ p11_rsa.cpp p11_session.cpp p11_slot.cpp p11_x509.cpp -</source>
\ No newline at end of file +</source> diff --git a/src/lib/prov/pkcs11/p11_ecdsa.cpp b/src/lib/prov/pkcs11/p11_ecdsa.cpp index dede8bd6c..44f116f88 100644 --- a/src/lib/prov/pkcs11/p11_ecdsa.cpp +++ b/src/lib/prov/pkcs11/p11_ecdsa.cpp @@ -30,13 +30,13 @@ bool PKCS11_ECDSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) return false; } - if(!strong) { return true; } - return KeyPair::signature_consistency_check(rng, *this, "EMSA1(SHA-1)"); + ECDSA_PublicKey pubkey(domain(), public_point()); + return KeyPair::signature_consistency_check(rng, *this, pubkey, "EMSA1(SHA-256)"); } ECDSA_PrivateKey PKCS11_ECDSA_PrivateKey::export_key() const @@ -57,8 +57,6 @@ namespace { class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature { public: - typedef PKCS11_EC_PrivateKey Key_Type; - PKCS11_ECDSA_Signature_Operation(const PKCS11_EC_PrivateKey& key, const std::string& emsa) : PK_Ops::Signature(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa)) {} @@ -124,8 +122,6 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification { public: - typedef PKCS11_EC_PublicKey Key_Type; - PKCS11_ECDSA_Verification_Operation(const PKCS11_EC_PublicKey& key, const std::string& emsa) : PK_Ops::Verification(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa)) {} |