# Keys helper

Keys helper allows to easily generate new RSA or AES keys.

# Provided operations

Below you can find the keys helper's provided operations with some examples

  1. Generates a new random AES-256 secret key with initializing vector.
fun generateAesKey(bytes: Int = 256): SecretKey
1
  1. Generates a secret aes key from the given bytes.
fun recoverAesKey(bytes: ByteArray): SecretKey
1
  1. Generates a new RSA key pair having the given bytes length.
    If no length is specified, the default is going to be 2048.
fun generateRsaKeyPair(bytes: Int = 2048): KeyPair
1
  1. Generates a new EC key pair of type secp256k1
fun generateEcKeyPair(): KeyPair
1
  1. Export public key of type RSA or EC into an HEX string.
fun exportPublicKeyHEX(key: PublicKey, type: String): String
1
  1. Export private key of type RSA or EC into an HEX string.
fun exportPrivateKeyHEX(key: PrivateKey, type: String): String
1