Class AesKey

All Implemented Interfaces:
Comparable<ByteArray>

public class AesKey extends ByteArray
Wrapper for a byte[] containing an AES Key. This is a replacement for Bouncy Castle's KeyParameter which was used for this purpose in previous versions of bitcoinj. Unfortunately, this created a Gradle _API_ dependency on Bouncy Castle when that wasn't strictly necessary.

We have made this change without deprecation because it affected many method signatures and because updating is a trivial change. If for some reason you have code that uses the Bouncy Castle KeyParameter type and need to convert to or from AesKey, you can temporarily use ofKeyParameter(KeyParameter) or toKeyParameter()

  • Constructor Details

    • AesKey

      public AesKey(byte[] keyBytes)
      Wrapper for a byte[] containing an AES Key
      Parameters:
      keyBytes - implementation-dependent AES Key bytes
  • Method Details

    • getKey

      @Deprecated public byte[] getKey()
      Deprecated.
      Provided to ease migration from KeyParameter.
      Returns:
      The key bytes
    • ofKeyParameter

      @Deprecated public static AesKey ofKeyParameter(org.bouncycastle.crypto.params.KeyParameter keyParameter)
      Deprecated.
      Use new AesKey(keyParameter.bytes())
      Provided to ease migration from KeyParameter.
      Parameters:
      keyParameter - instance to convert
      Returns:
      new, preferred container for AES keys
    • toKeyParameter

      @Deprecated public org.bouncycastle.crypto.params.KeyParameter toKeyParameter()
      Deprecated.
      Use new KeyParameter(key.bytes)
      Provided to ease migration from KeyParameter.
      Returns:
      if for some reason you still need (temporarily, we hope) a KeyParameter