@Test public void testDecrypt() throws IOException { final String CODESIGNING_ASC_ENC = System.getenv("CODESIGNING_ASC_ENC"); final String passphrase = System.getenv("PASSPHRASE"); if (!isEmpty(CODESIGNING_ASC_ENC) && !isEmpty(passphrase)) { logger.info(String.format("CODESIGNING_ASC_ENC: %s", CODESIGNING_ASC_ENC)); final EncryptedFile codesigningAscEnc = FileSafe.decryptByJavaOpenssl(this.logger, Paths.get(CODESIGNING_ASC_ENC)); if (codesigningAscEnc.exists()) { codesigningAscEnc.decrypt(passphrase, createTempFile("tmp", "codesigning.asc.enc")); } else { logger.info(String.format(" Skip decrypting [%s], file absent.", CODESIGNING_ASC_ENC)); } } }
@Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } }
EncryptedFileOpensslJava extends AbstractResource implements EncryptedFile { @Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } } }
EncryptedFileOpensslJava extends AbstractResource implements EncryptedFile { @Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } } EncryptedFileOpensslJava(final Logger logger, final Path path); }
EncryptedFileOpensslJava extends AbstractResource implements EncryptedFile { @Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } } EncryptedFileOpensslJava(final Logger logger, final Path path); @Override void decrypt(final String passphrase, final Path targetPath); }
EncryptedFileOpensslJava extends AbstractResource implements EncryptedFile { @Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } } EncryptedFileOpensslJava(final Logger logger, final Path path); @Override void decrypt(final String passphrase, final Path targetPath);  }