diff options
author | 2018-03-14 16:35:31 -0700 | |
---|---|---|
committer | 2018-03-14 17:02:47 -0700 | |
commit | da00ff6db5e68773996ec79d711c45fb3444c580 (patch) | |
tree | 0387aa1f70a468e6c3264767454ae6f4528f59e8 /SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp | |
parent | 535535b7c5f2781fa096a5fd00a762d24db4eddc (diff) |
Remove win32 support in SoftHSMv2
Due to license issue, we have to remove win32 support in SoftHSMv2.
Issue-ID: AAF-151
Change-Id: I31dda45ed84065819e26be8205747dd096a37432
Signed-off-by: NingSun <ning.sun@intel.com>
Diffstat (limited to 'SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp')
-rw-r--r-- | SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp b/SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp index 91f6876..50d42e0 100644 --- a/SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp +++ b/SoftHSMv2/src/lib/crypto/test/GOSTTests.cpp @@ -264,6 +264,40 @@ void GOSTTests::testSerialisation() gost->recycleKeyPair(dKP); } +void GOSTTests::testPKCS8() +{ + AsymmetricKeyPair* kp; + ECParameters *p; + ByteString curve = "06072a850302022301"; + + // Get parameters + p = new ECParameters; + CPPUNIT_ASSERT(p != NULL); + p->setEC(curve); + + // Generate key-pair + CPPUNIT_ASSERT(gost->generateKeyPair(&kp, p)); + CPPUNIT_ASSERT(kp != NULL); + + GOSTPrivateKey* priv = (GOSTPrivateKey*) kp->getPrivateKey(); + CPPUNIT_ASSERT(priv != NULL); + + // Encode and decode the private key + ByteString pkcs8 = priv->PKCS8Encode(); + CPPUNIT_ASSERT(pkcs8.size() != 0); + + GOSTPrivateKey* dPriv = (GOSTPrivateKey*) gost->newPrivateKey(); + CPPUNIT_ASSERT(dPriv != NULL); + + CPPUNIT_ASSERT(dPriv->PKCS8Decode(pkcs8)); + + CPPUNIT_ASSERT(priv->getD() == dPriv->getD()); + CPPUNIT_ASSERT(priv->getEC() == dPriv->getEC()); + + gost->recycleKeyPair(kp); + gost->recyclePrivateKey(dPriv); +} + void GOSTTests::testSigningVerifying() { AsymmetricKeyPair* kp; |