Example usage for org.bouncycastle.util Arrays reverse

List of usage examples for org.bouncycastle.util Arrays reverse

Introduction

In this page you can find the example usage for org.bouncycastle.util Arrays reverse.

Prototype

public static int[] reverse(int[] a) 

Source Link

Usage

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));
}