private String encode( String string ) throws UnsupportedEncodingException { EncryptionResult result = cryptoService.encryptForCluster(clusterName, EncryptUriDescriptor.PASSWORD_ALIAS, string.getBytes(StandardCharsets.UTF_8)); string = Base64.encodeBase64URLSafeString(result.toByteAray()); return string; }
private String encode( String string ) throws UnsupportedEncodingException { EncryptionResult result = null; try { result = encryptor.encrypt(string); } catch (Exception e) { log.unableToEncryptValue(e); } string = Base64.encodeBase64URLSafeString(result.toByteAray()); return string; } }
private String encode( String string ) throws UnsupportedEncodingException { EncryptionResult result = null; try { result = encryptor.encrypt(string); } catch (Exception e) { log.unableToEncryptValue(e); } string = Base64.encodeBase64URLSafeString(result.toByteAray()); return string; } }
private String compressEncryptBase64(final Object o) { if (o == null || o.equals("") || (o instanceof Map<?,?> && ((Map<?,?>)o).isEmpty())) { return null; } else { byte[] bytes = javaSerializationHelper.serializeToBytes((Serializable) o); /* compress the data */ try { bytes = compress(bytes); if(bytes.length > 3000) { logger.warn("Cookie too big, it might not be properly set"); } } catch (final IOException e) { throw new TechnicalException(e); } EncryptionResult result = cryptoService.encryptForCluster(this.clusterName, PAC4J_PASSWORD, bytes); return Base64.encodeBase64String(result.toByteAray()); } }
private String compressEncryptBase64(final Object o) { if (o == null || o.equals("") || (o instanceof Map<?,?> && ((Map<?,?>)o).isEmpty())) { return null; } else { byte[] bytes = javaSerializationHelper.serializeToBytes((Serializable) o); /* compress the data */ try { bytes = compress(bytes); if(bytes.length > 3000) { logger.warn("Cookie too big, it might not be properly set"); } } catch (final IOException e) { throw new TechnicalException(e); } EncryptionResult result = cryptoService.encryptForCluster(this.clusterName, PAC4J_PASSWORD, bytes); return Base64.encodeBase64String(result.toByteAray()); } }