byte[] encryptedPkcs8 = encinfo.getEncoded();
/** * Get the encrypted seed private key from this advertisement. * * @return the encoded encrypted private key, a BASE64 String of a DER * encoded PKCS8 EncrpytePrivateKeyInfo. */ public String getEncryptedPrivKey() { try { if (null == encryptedPrivateKey) { return null; } return PSEUtils.base64Encode(encryptedPrivateKey.getEncoded()); } catch (Exception failed) { if (Logging.SHOW_SEVERE && LOG.isLoggable(Level.SEVERE)) { LOG.log(Level.SEVERE, "Failed to process private key", failed); } IllegalStateException failure = new IllegalStateException("Failed to process private key"); failure.initCause(failed); throw failure; } }
StringBuilder buffer = new StringBuilder(); buffer.append(indentation).append("-----BEGIN ENCRYPTED PRIVATE KEY-----\n"); buffer.append(encodeBytes(encryptedKeyInfo.getEncoded(), indentation)); buffer.append("\n").append(indentation).append("-----END ENCRYPTED PRIVATE KEY-----"); String result = buffer.toString();
byte[] encryptedPkcs8 = encinfo.getEncoded();
FileUtils.writeByteArrayToFile(fields.getNewKeyFile(), info.getEncoded());
return encPrivateKeyInfo.getEncoded(); } catch (GeneralSecurityException ex) { throw new CryptoException("NoEncryptPkcs8PrivateKey.exception.message", ex);