aboutsummaryrefslogtreecommitdiffstats
path: root/libparc/parc/security/test
diff options
context:
space:
mode:
authorDevel <acompagn+fdio@cisco.com>2018-04-16 16:52:31 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2018-04-16 15:23:49 +0000
commit799484812a3fdd9d5d6e71c5fc4b483043347bca (patch)
tree40993aeb725715bbb97bc353351e718639ba0d53 /libparc/parc/security/test
parente4fcd260cb99434033a8ccfba12eee12dab190b9 (diff)
Added method to retrieve the signature length from the signer. Fixed bug on parc-publickey
Change-Id: If188601e83d0cebf42d2e868e1dce430eabfa1f2 Signed-off-by: Devel <acompagn+fdio@cisco.com>
Diffstat (limited to 'libparc/parc/security/test')
-rw-r--r--libparc/parc/security/test/test_parc_PublicKeyECSigner.c12
-rw-r--r--libparc/parc/security/test/test_parc_PublicKeySigner.c13
-rw-r--r--libparc/parc/security/test/test_parc_SymmetricKeySigner.c11
3 files changed, 36 insertions, 0 deletions
diff --git a/libparc/parc/security/test/test_parc_PublicKeyECSigner.c b/libparc/parc/security/test/test_parc_PublicKeyECSigner.c
index 417282a0..90ab1755 100644
--- a/libparc/parc/security/test/test_parc_PublicKeyECSigner.c
+++ b/libparc/parc/security/test/test_parc_PublicKeyECSigner.c
@@ -105,6 +105,7 @@ LONGBOW_TEST_FIXTURE(Object)
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_HashCode);
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_IsValid);
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_ToString);
+ LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_SignatureSize);
}
LONGBOW_TEST_FIXTURE_SETUP(Object)
@@ -485,6 +486,17 @@ LONGBOW_TEST_CASE(Global, parcSigner_CreateKeyId)
parcSigner_Release(&signer);
}
+LONGBOW_TEST_CASE(Object, parcPublicKeySigner_SignatureSize)
+{
+ PARCPublicKeySigner *publicKeySigner = _createSigner("test_key_size");
+ PARCSigner *signer = parcSigner_Create(publicKeySigner, PARCPublicKeySignerAsSigner);
+
+ assertTrue(parcSigner_GetSignatureSize(signer) == 72, "Key size unexpected %lu ", parcSigner_GetSignatureSize(signer));
+ parcPublicKeySigner_Release(&publicKeySigner);
+ parcSigner_Release(&signer);
+}
+
+
int
main(int argc, char *argv[argc])
{
diff --git a/libparc/parc/security/test/test_parc_PublicKeySigner.c b/libparc/parc/security/test/test_parc_PublicKeySigner.c
index 49fd42c7..69fb7049 100644
--- a/libparc/parc/security/test/test_parc_PublicKeySigner.c
+++ b/libparc/parc/security/test/test_parc_PublicKeySigner.c
@@ -97,6 +97,7 @@ LONGBOW_TEST_FIXTURE(Object)
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_HashCode);
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_IsValid);
LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_ToString);
+ LONGBOW_RUN_TEST_CASE(Object, parcPublicKeySigner_SignatureSize);
}
LONGBOW_TEST_FIXTURE_SETUP(Object)
@@ -443,6 +444,18 @@ LONGBOW_TEST_CASE(Global, parcSigner_CreateKeyId)
parcSigner_Release(&signer);
}
+LONGBOW_TEST_CASE(Object, parcPublicKeySigner_SignatureSize)
+{
+ PARCPublicKeySigner *publicKeySigner = _createSigner("test_key_size");
+ PARCSigner *signer = parcSigner_Create(publicKeySigner, PARCPublicKeySignerAsSigner);
+
+
+ assertTrue(parcSigner_GetSignatureSize(signer) == 128, "Modulus size unexpected %lu ", parcSigner_GetSignatureSize(signer));
+ parcPublicKeySigner_Release(&publicKeySigner);
+ parcSigner_Release(&signer);
+}
+
+
int
main(int argc, char *argv[argc])
{
diff --git a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
index 562ba6c6..01874e75 100644
--- a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
+++ b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
@@ -237,6 +237,17 @@ LONGBOW_TEST_CASE(Specialization, test_hmac_sha512)
parcBuffer_Release(&output);
}
+LONGBOW_TEST_CASE(Global, parcSymmetricSigner_SignatureSize)
+{
+ PARCSymmetricKeySigner *symmetricSigner = _createSigner();
+
+ PARCSigner *signer = parcSigner_Create(symmetricSigner, PARCSymmetricKeySignerAsSigner);
+
+ assertTrue(parcSigner_GetSignatureSize(signer) == 32, "Key size unexpected %d ", parcSigner_GetSignatureSize(signer));
+ parcSigner_Release(&signer);
+ parcSymmetricKeySigner_Release(&symmetricSigner);
+}
+
int
main(int argc, char *argv[argc])
{