List of usage examples for java.util Base64 getDecoder
public static Decoder getDecoder()
From source file:cn.com.fubon.springboot.starter.jwt.auth.JwtTokenServiceImpl.java
public JwtTokenServiceImpl(String secretkey) { this.secretkey = Base64.getDecoder().decode(secretkey); }
From source file:com.vsct.dt.strowgr.admin.repository.consul.ConsulItem.java
T value(ObjectMapper mapper) { try {//from w w w. j a va 2 s . com return mapper.readValue(Base64.getDecoder().decode(value), new TypeReference<T>() { }); } catch (IOException e) { throw new RuntimeException(e); } }
From source file:com.thoughtworks.go.server.util.EncryptionHelper.java
public static String decryptUsingRSA(String cipherText, String privateKeyContent) throws NoSuchPaddingException, NoSuchAlgorithmException, IOException, InvalidKeySpecException, BadPaddingException, IllegalBlockSizeException, InvalidKeyException { Cipher decryptCipher = Cipher.getInstance("RSA"); decryptCipher.init(Cipher.DECRYPT_MODE, getRSAPrivateKeyFrom(privateKeyContent)); return new String(decryptCipher.doFinal(Base64.getDecoder().decode(cipherText)), UTF_8); }
From source file:keywhiz.auth.cookie.CookieAuthenticator.java
private Optional<UserCookieData> getUserCookieData(Cookie sessionCookie) { byte[] ciphertext = Base64.getDecoder().decode(sessionCookie.getValue()); UserCookieData cookieData = null;//from w w w . j a v a 2s.c om try { cookieData = mapper.readValue(encryptor.decrypt(ciphertext), UserCookieData.class); if (cookieData.getExpiration().isBefore(ZonedDateTime.now())) { cookieData = null; } } catch (AEADBadTagException e) { logger.warn("Cookie with bad MAC detected"); } catch (Exception e) { /* this cookie ain't gettin decrypted, it's bad */ } return Optional.ofNullable(cookieData); }
From source file:org.apache.accumulo.test.util.SerializationUtil.java
public static void deserializeWritableBase64(Writable writable, String str) { byte[] b = Base64.getDecoder().decode(str); deserializeWritable(writable, b);//from w w w. ja va 2s. co m }
From source file:azkaban.crypto.Crypto.java
public static String decode(String s) { return new String(Base64.getDecoder().decode(s)); }
From source file:com.vsct.dt.strowgr.admin.repository.consul.ConsulItem.java
String valueFromBase64() {
return new String(Base64.getDecoder().decode(value));
}
From source file:com.thoughtworks.go.plugin.access.common.models.Image.java
public byte[] getDataAsBytes() { if (dataAsBytes == null) { dataAsBytes = Base64.getDecoder().decode(data); } return dataAsBytes; }
From source file:org.camunda.bpm.extension.batch.core.CustomBatchConfigurationJsonConverter.java
@Override public CustomBatchConfiguration<T> toObject(final JSONObject json) { final String jsonSerializedData = json.getString(DATA_SERIALIZED); final byte[] byteArray = Base64.getDecoder().decode(jsonSerializedData); return CustomBatchConfiguration.of(SerializationUtils.deserialize(byteArray), json.getBoolean(EXCLUSIVE)); }
From source file:fi.helsinki.opintoni.service.ImageService.java
@SkipLoggingAspect public byte[] base64ToBytes(String imageBase64) { return Base64.getDecoder().decode(imageBase64); }