lock-key.private.core

Private functions used by lock-key.core. Do not reference this namespace
outside lock-key.core as these fns are subject to change.

byte-array-class

byte-array?

(byte-array? object)
Tests if a value is a byte[]. Returns true/false

object - the object to test

get-cipher

(get-cipher mode seed iv-bytes)
Returns an AES/CBC/PKCS5Padding Cipher which can be used to encrypt or decrypt a
byte[], depending on the mode of the Cipher.

mode     - (int) see https://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html
                 for available modes. Typically this will be either Cipher/ENCRYPT_MODE
                 or Cipher/DECRYPT_MODE.
seed     - (String) the encryption seed / secret
iv-bytes - (byte[]) the initialization vector

get-iv-bytes

(get-iv-bytes)
Initializes and returns a random initialization vector byte[]

get-raw-key

(get-raw-key seed)
Returns an AES SecretKey encoded as a byte[]

seed - (String)the seed to initialize the key with