tuweni / org.apache.tuweni.bytes / Bytes / secure

secure

open static fun secure(value: ByteArray!): Bytes! (source)

Wrap the provided byte array as a Bytes value, encrypted in memory.

Parameters

value - ByteArray!: The value to secure.

Return
Bytes!: A Bytes value securing value.

open static fun secure(value: ByteArray!, offset: Int, length: Int): Bytes! (source)

Wrap a slice of a byte array as a Bytes value, encrypted in memory.

Parameters

value - ByteArray!: The value to secure.

offset - Int: The index (inclusive) in value of the first byte exposed by the returned value. In other words, you will have wrap(value, o, l).get(0) == value[o].

length - Int: The length of the resulting value.

Exceptions

IndexOutOfBoundsException - if offset < 0 || (value.length > 0 && offset >= value.length).

IllegalArgumentException - if length < 0 || offset + length > value.length.

Return
Bytes!: A Bytes value that holds securely the bytes of value from offset (inclusive) to offset + length (exclusive).