Package com.google.crypto.tink.util
Class SecretBytes
- java.lang.Object
-
- com.google.crypto.tink.util.SecretBytes
-
@Immutable public final class SecretBytes extends java.lang.ObjectA class storing an immutable byte array, protecting the data viaSecretKeyAccess.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecretBytescopyFrom(byte[] value, SecretKeyAccess access)Creates a new SecretBytes with the contents given invalue.booleanequalsSecretBytes(SecretBytes other)Returns true if theotherbyte array has the same bytes, in time depending only on the length of both SecretBytes objects.static SecretBytesrandomBytes(int length)Creates a new SecretBytes with bytes chosen uniformly at random of lengthlength.intsize()Returns the length of the bytes wrapped by this object.byte[]toByteArray(SecretKeyAccess access)Returns a copy of the bytes wrapped by this object.
-
-
-
Method Detail
-
copyFrom
public static SecretBytes copyFrom(byte[] value, SecretKeyAccess access)
Creates a new SecretBytes with the contents given invalue.The parameter
accessmust be non-null.
-
randomBytes
public static SecretBytes randomBytes(int length)
Creates a new SecretBytes with bytes chosen uniformly at random of lengthlength.
-
toByteArray
public byte[] toByteArray(SecretKeyAccess access)
Returns a copy of the bytes wrapped by this object.The parameter
accessmust be non-null.
-
size
public int size()
Returns the length of the bytes wrapped by this object.
-
equalsSecretBytes
public boolean equalsSecretBytes(SecretBytes other)
Returns true if theotherbyte array has the same bytes, in time depending only on the length of both SecretBytes objects.
-
-