List of usage examples for org.bouncycastle.util Arrays reverse
public static int[] reverse(int[] a)
From source file:google.registry.keyring.kms.FakeKmsConnection.java
License:Open Source License
/** * Returns a dummy {@link EncryptResponse}. * * <p>The "encrypted value" in the response is the provided value reversed and then base64-encoded * and the name of the cryptoKeyVersion is {@code cryptoKeyName + "/foo"}. *//* w w w .j a v a 2 s .co m*/ @Override public EncryptResponse encrypt(String cryptoKeyName, byte[] plaintext) throws IOException { return EncryptResponse.create(BaseEncoding.base64().encode(Arrays.reverse(plaintext)), cryptoKeyName + "/foo"); }
From source file:google.registry.keyring.kms.FakeKmsConnection.java
License:Open Source License
/** * Returns a "decrypted" plaintext.//from w w w . j a va 2 s. c om * * <p>The plaintext is the encodedCiphertext base64-decoded and then reversed. */ @Override public byte[] decrypt(String cryptoKeyName, String encodedCiphertext) throws IOException { return Arrays.reverse(BaseEncoding.base64().decode(encodedCiphertext)); }