CryptoPrimitives implements CryptoSuite { @Override public Properties getProperties() { Properties properties = new Properties(); properties.setProperty(Config.HASH_ALGORITHM, hashAlgorithm); properties.setProperty(Config.SECURITY_LEVEL, Integer.toString(securityLevel)); properties.setProperty(Config.CERTIFICATE_FORMAT, CERTIFICATE_FORMAT); properties.setProperty(Config.SIGNATURE_ALGORITHM, DEFAULT_SIGNATURE_ALGORITHM); return properties; } CryptoPrimitives(); Certificate bytesToCertificate(byte[] certBytes); PrivateKey bytesToPrivateKey(byte[] pemKey); @Override boolean verify(byte[] pemCertificate, String signatureAlgorithm, byte[] signature, byte[] plainText); KeyStore getTrustStore(); void addCACertificateToTrustStore(File caCertPem, String alias); void addCACertificateToTrustStore(byte[] bytes, String alias); @Override void loadCACertificates(Collection<Certificate> certificates); @Override void loadCACertificatesAsBytes(Collection<byte[]> certificatesBytes); @Override KeyPair keyGen(); @Override byte[] sign(PrivateKey key, byte[] data); String generateCertificationRequest(String subject, KeyPair pair); @Override byte[] hash(byte[] input); @Override CryptoSuiteFactory getCryptoSuiteFactory(); void init(); @Override Properties getProperties(); byte[] certificateToDER(String certificatePEM);  }
@Test public void testGetSetProperties() throws Exception { Properties propsIn = new Properties(); try { final String expectHash = "SHA3"; propsIn.setProperty(Config.SECURITY_LEVEL, "384"); propsIn.setProperty(Config.HASH_ALGORITHM, expectHash); CryptoSuite testCrypto = CryptoSuiteFactory.getDefault().getCryptoSuite(propsIn); String expectedCurve = config.getSecurityCurveMapping().get(384); assertEquals("secp384r1", expectedCurve); assertEquals(expectedCurve, getField(testCrypto, "curveName")); assertEquals(384, getField(testCrypto, "securityLevel")); Properties cryptoProps = ((CryptoPrimitives) testCrypto).getProperties(); assertEquals(cryptoProps.getProperty(Config.SECURITY_LEVEL), "384"); cryptoProps = testCrypto.getProperties(); assertEquals(cryptoProps.getProperty(Config.HASH_ALGORITHM), expectHash); assertEquals(expectHash, getField(testCrypto, "hashAlgorithm")); assertEquals(cryptoProps.getProperty(Config.SECURITY_LEVEL), "384"); assertEquals(testCrypto, CryptoSuiteFactory.getDefault().getCryptoSuite(propsIn)); } catch (CryptoException | InvalidArgumentException e) { fail("testGetSetProperties should not throw exception. Error: " + e.getMessage()); } }