public SecretRewriter() throws GeneralSecurityException { cipher = Secret.getCipher("AES"); key = HistoricalSecrets.getLegacyKey(); }
/*package*/ static Secret decrypt(String data, CryptoConfidentialKey key) throws IOException, GeneralSecurityException { byte[] in = Base64.decode(data.toCharArray()); Secret s = tryDecrypt(key.decrypt(), in); if (s!=null) return s; // try our historical key for backward compatibility Cipher cipher = Secret.getCipher("AES"); cipher.init(Cipher.DECRYPT_MODE, getLegacyKey()); return tryDecrypt(cipher, in); }
public SecretRewriter() throws GeneralSecurityException { cipher = Secret.getCipher("AES"); key = HistoricalSecrets.getLegacyKey(); }
/*package*/ static Secret decrypt(String data, CryptoConfidentialKey key) throws IOException, GeneralSecurityException { byte[] in = Base64.decode(data.toCharArray()); Secret s = tryDecrypt(key.decrypt(), in); if (s!=null) return s; // try our historical key for backward compatibility Cipher cipher = Secret.getCipher("AES"); cipher.init(Cipher.DECRYPT_MODE, getLegacyKey()); return tryDecrypt(cipher, in); }