#include <openssl/obj_mac.h>
#include <ckm/ckm-error.h>
#include <ckm/ckm-type.h>
-#include <generic-key.h>
+#include <key-impl.h>
#include <CryptoService.h>
#include <key-manager-util.h>
#include <assert.h>
int CryptoService::createKeyPairRSA(const int size, // size in bits [1024, 2048, 4096]
- GenericKey &createdPrivateKey, // returned value
- GenericKey &createdPublicKey) // returned value
+ KeyImpl &createdPrivateKey, // returned value
+ KeyImpl &createdPublicKey) // returned value
{
EVP_PKEY_CTX *ctx = NULL;
EVP_PKEY *pkey = NULL;
ReThrowMsg(CryptoService::Exception::opensslError,"Error in opensslError function !!");
}
- GenericKey::EvpShPtr ptr(pkey, EVP_PKEY_free); // shared ptr will free pkey
+ KeyImpl::EvpShPtr ptr(pkey, EVP_PKEY_free); // shared ptr will free pkey
- createdPrivateKey = GenericKey(ptr, KeyType::KEY_RSA_PRIVATE);
- createdPublicKey = GenericKey(ptr, KeyType::KEY_RSA_PUBLIC);
+ createdPrivateKey = KeyImpl(ptr, KeyType::KEY_RSA_PRIVATE);
+ createdPublicKey = KeyImpl(ptr, KeyType::KEY_RSA_PUBLIC);
if(pparam) {
EVP_PKEY_free(pparam);
}
int CryptoService::createKeyPairECDSA(ElipticCurve type,
- GenericKey &createdPrivateKey, // returned value
- GenericKey &createdPublicKey) // returned value
+ KeyImpl &createdPrivateKey, // returned value
+ KeyImpl &createdPublicKey) // returned value
{
int ecCurve = NOT_DEFINED;
EVP_PKEY_CTX *pctx = NULL;
ReThrowMsg(CryptoService::Exception::opensslError,"Error in openssl function !!");
}
- GenericKey::EvpShPtr ptr(pkey, EVP_PKEY_free); // shared ptr will free pkey
+ KeyImpl::EvpShPtr ptr(pkey, EVP_PKEY_free); // shared ptr will free pkey
- createdPrivateKey = GenericKey(ptr, KeyType::KEY_ECDSA_PRIVATE);
- createdPublicKey = GenericKey(ptr, KeyType::KEY_ECDSA_PUBLIC);
+ createdPrivateKey = KeyImpl(ptr, KeyType::KEY_ECDSA_PRIVATE);
+ createdPublicKey = KeyImpl(ptr, KeyType::KEY_ECDSA_PUBLIC);
if(pparam) {
EVP_PKEY_free(pparam);
return CKM_CRYPTO_CREATEKEY_SUCCESS;
}
-int CryptoService::createSignature(const GenericKey &privateKey,
+int CryptoService::createSignature(const KeyImpl &privateKey,
const RawBuffer &message,
const HashAlgorithm hashAlgo,
const RSAPaddingAlgorithm padAlgo,
return CKM_CREATE_SIGNATURE_SUCCESS;
}
-int CryptoService::verifySignature(const GenericKey &publicKey,
+int CryptoService::verifySignature(const KeyImpl &publicKey,
const RawBuffer &message,
const RawBuffer &signature,
const HashAlgorithm hashAlgo,