From c99318c9375f4a972b9c82dcfdfb7a879d29eba4 Mon Sep 17 00:00:00 2001 From: Devel Date: Tue, 8 May 2018 17:58:40 +0200 Subject: Removed cryptosuite as required parameter while reading p12. Added hashtype Change-Id: I5628c4e34b236b02e2c524194735f67024014000 Signed-off-by: Devel --- libparc/parc/security/parc_Identity.c | 2 +- libparc/parc/security/parc_Identity.h | 2 +- libparc/parc/security/parc_IdentityFile.c | 7 +++---- libparc/parc/security/parc_IdentityFile.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libparc/parc/security/parc_Identity.c b/libparc/parc/security/parc_Identity.c index a132964a..da68fbd2 100755 --- a/libparc/parc/security/parc_Identity.c +++ b/libparc/parc/security/parc_Identity.c @@ -101,7 +101,7 @@ parcIdentity_GetPassWord(const PARCIdentity *identity) PARCSigner * parcIdentity_CreateSigner(const PARCIdentity *identity, PARCCryptoSuite suite) { - return identity->interface->GetSigner(identity->instance, suite); + return identity->interface->GetSigner(identity->instance, parcCryptoSuite_GetSigningAlgorithm(suite)); } void diff --git a/libparc/parc/security/parc_Identity.h b/libparc/parc/security/parc_Identity.h index 32b9b179..2cdcbad3 100755 --- a/libparc/parc/security/parc_Identity.h +++ b/libparc/parc/security/parc_Identity.h @@ -74,7 +74,7 @@ typedef struct parc_identity_interface { /** * @see parcIdentity_CreateSigner */ - PARCSigner *(*GetSigner)(const void *identity, PARCCryptoSuite suite); + PARCSigner *(*GetSigner)(const void *identity, PARCCryptoHashType hash); /** * @see parcIdentity_Equals diff --git a/libparc/parc/security/parc_IdentityFile.c b/libparc/parc/security/parc_IdentityFile.c index 38d3637c..0d22a51e 100644 --- a/libparc/parc/security/parc_IdentityFile.c +++ b/libparc/parc/security/parc_IdentityFile.c @@ -42,7 +42,7 @@ PARCIdentityInterface *PARCIdentityFileAsPARCIdentity = &(PARCIdentityInterface) .Release = (void (*)(void **))parcIdentityFile_Release, .GetPassWord = (void *(*)(const void *))parcIdentityFile_GetPassWord, .GetFileName = (void *(*)(const void *))parcIdentityFile_GetFileName, - .GetSigner = (PARCSigner * (*)(const void *, PARCCryptoSuite))parcIdentityFile_CreateSigner, + .GetSigner = (PARCSigner * (*)(const void *, PARCCryptoHashType))parcIdentityFile_CreateSigner, .Equals = (bool (*)(const void *, const void *))parcIdentityFile_Equals, .Display = (void (*)(const void *, size_t))parcIdentityFile_Display }; @@ -104,7 +104,7 @@ parcIdentityFile_GetPassWord(const PARCIdentityFile *identity) } PARCSigner * -parcIdentityFile_CreateSigner(const PARCIdentityFile *identity, PARCCryptoSuite suite) +parcIdentityFile_CreateSigner(const PARCIdentityFile *identity, PARCCryptoHashType hash) { PARCPkcs12KeyStore *keyStore = parcPkcs12KeyStore_Open(identity->fileName, identity->passWord, PARCCryptoHashType_SHA256); PARCKeyStore *publicKeyStore = parcKeyStore_Create(keyStore, PARCPkcs12KeyStoreAsKeyStore); @@ -112,8 +112,7 @@ parcIdentityFile_CreateSigner(const PARCIdentityFile *identity, PARCCryptoSuite PARCSigningAlgorithm signAlgo = parcKeyStore_getSigningAlgorithm(publicKeyStore); - if (signAlgo != parcCryptoSuite_GetSigningAlgorithm(suite)) - return NULL; + PARCCryptoSuite suite = parcCryptoSuite_GetFromSigningHash(signAlgo, hash); PARCPublicKeySigner *signer = parcPublicKeySigner_Create(publicKeyStore, suite); PARCSigner *pkSigner = parcSigner_Create(signer, PARCPublicKeySignerAsSigner); diff --git a/libparc/parc/security/parc_IdentityFile.h b/libparc/parc/security/parc_IdentityFile.h index c125ffb2..46ff87cb 100644 --- a/libparc/parc/security/parc_IdentityFile.h +++ b/libparc/parc/security/parc_IdentityFile.h @@ -205,7 +205,7 @@ const char *parcIdentityFile_GetPassWord(const PARCIdentityFile *identity); * } * @endcode */ -PARCSigner *parcIdentityFile_CreateSigner(const PARCIdentityFile *identity, PARCCryptoSuite suite); +PARCSigner *parcIdentityFile_CreateSigner(const PARCIdentityFile *identity, PARCCryptoHashType hash); /** * Determine if two PARCIdentityFiles are equal. -- cgit 1.2.3-korg