Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Test public void testEncipherment() throws Exception { // needed parameters // the value to encrypt String valueToEncrypt = "my test value to encrypt!"; // Path to the certificate file needed for encryption String certificatePath = "path/to/the/certificate/file"; // Path to the private key file to decryptneeded the symmetric key withfor decryption String privateKeyPath = "path/to/the/privatekey/file"; // call encrypt methode above with the provided parameters String encryptedValue = encrypt(valueToEncrypt, certificatePath); // call decrypt methode above with the provided parameters String decryptedValue = decrypt(encryptedValue, privateKeyPath); LOGGER.info("valueToEncrypt:\t" + valueToEncrypt); LOGGER.info("encrypted Value:\t" + encryptedValue); LOGGER.info("decrypted Value:\t" + decryptedValue); Assert.assertEquals(valueToEncrypt, decryptedValue); } |
Overview
Content Tools