private static synchronized Encryptor getEncryptor() { if (encryptor == null) { encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return encryptor; }
EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(SecurityUtil.decrypt(source).getBytes()); jgen.writeStringField("encryptedBytes", Base64.getEncoder().encodeToString(encryptedBytes));
@Override public void serialize(final Object object, final ObjectEncoder encoder) { final GuardedByteArray val = (GuardedByteArray) object; val.access((byte[] clearBytes) -> { byte[] encryptedBytes = null; try { encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(clearBytes); encoder.writeByteArrayContents(encryptedBytes); } finally { SecurityUtil.clear(encryptedBytes); } }); } });
@Override public void serialize(final Object object, final ObjectEncoder encoder) { final GuardedByteArray val = (GuardedByteArray) object; val.access((byte[] clearBytes) -> { byte[] encryptedBytes = null; try { encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(clearBytes); encoder.writeByteArrayContents(encryptedBytes); } finally { SecurityUtil.clear(encryptedBytes); } }); } });
private static synchronized Encryptor getEncryptor() { if (encryptor == null) { encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return encryptor; }
EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(SecurityUtil.decrypt(source).getBytes()); jgen.writeStringField("encryptedBytes", Base64.getEncoder().encodeToString(encryptedBytes));
private static synchronized Encryptor getEncryptor() { if (_encryptor == null) { _encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return _encryptor; }
@Override public Object deserialize(final ObjectDecoder decoder) { byte[] encryptedBytes = null; byte[] clearBytes = null; try { encryptedBytes = decoder.readByteArrayContents(); clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes); return new GuardedByteArray(clearBytes); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); } }
private static synchronized Encryptor getEncryptor() { if (encryptor == null) { encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return encryptor; }
@Override public Object deserialize(final ObjectDecoder decoder) { byte[] encryptedBytes = null; byte[] clearBytes = null; try { encryptedBytes = decoder.readByteArrayContents(); clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes); return new GuardedByteArray(clearBytes); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); } }
private static synchronized Encryptor getEncryptor() { if (_encryptor == null) { _encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return _encryptor; }
@Override public Object deserialize(final ObjectDecoder decoder) { byte[] encryptedBytes = null; byte[] clearBytes = null; try { encryptedBytes = decoder.readByteArrayContents(); clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes); return new GuardedByteArray(clearBytes); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); } }
private static synchronized Encryptor getEncryptor() { if (encryptor == null) { encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); } return encryptor; }
final byte[] clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes);
EncryptorFactory encryptorFactory = EncryptorFactory.getInstance(); subresult.addReturn("encryptorFactoryImpl", encryptorFactory.getClass()); LOGGER.debug("Encryptor factory implementation class: {}", encryptorFactory.getClass()); Encryptor encryptor = EncryptorFactory.getInstance().newRandomEncryptor(); subresult.addReturn("encryptorImpl", encryptor.getClass()); LOGGER.debug("Encryptor implementation class: {}", encryptor.getClass());
final byte[] clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes);
@Override public void serialize(final Object object, final ObjectEncoder encoder) { final GuardedString val = (GuardedString) object; val.access((final char[] clearChars) -> { byte[] encryptedBytes = null; byte[] clearBytes = null; try { clearBytes = SecurityUtil.charsToBytes(clearChars); encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(clearBytes); encoder.writeByteArrayContents(encryptedBytes); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); } }); }
@Override public void serialize(final Object object, final ObjectEncoder encoder) { final GuardedString val = (GuardedString) object; val.access((final char[] clearChars) -> { byte[] encryptedBytes = null; byte[] clearBytes = null; try { clearBytes = SecurityUtil.charsToBytes(clearChars); encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(clearBytes); encoder.writeByteArrayContents(encryptedBytes); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); } }); }
@Override public Object deserialize(final ObjectDecoder decoder) { byte[] encryptedBytes = null; byte[] clearBytes = null; char[] clearChars = null; try { encryptedBytes = decoder.readByteArrayContents(); clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes); clearChars = SecurityUtil.bytesToChars(clearBytes); return new GuardedString(clearChars); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); SecurityUtil.clear(clearChars); } }
@Override public Object deserialize(final ObjectDecoder decoder) { byte[] encryptedBytes = null; byte[] clearBytes = null; char[] clearChars = null; try { encryptedBytes = decoder.readByteArrayContents(); clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt( encryptedBytes); clearChars = SecurityUtil.bytesToChars(clearBytes); return new GuardedString(clearChars); } finally { SecurityUtil.clear(encryptedBytes); SecurityUtil.clear(clearBytes); SecurityUtil.clear(clearChars); } }