hwsecurity-openpgp / de.cotech.hw.openpgp.pairedkey / PairedEncryptor /

PairedEncryptor

open class PairedEncryptor

This use case class performs an “encrypt” operation on some data, parametrized by a PairedSecurityKey.

ByteSecret sessionSecret = SecretGenerator.getInstance().createRandom(32);
byte[] encryptedSessionSecret = new PairedEncryptor(pairedSecurityKey).encrypt(sessionSecret);

The encryptedSessionSecret is typically stored in an EncryptedSessionStorage, to be able to later restore the sessionSecret using a PairedDecryptor.

The sessionSecret can be used for symmetric encryption operations, e.g. to encrypt a database. Once it has been deleted, it can only be restored from the encryptedSessionSecret when the paired security key is connected.

See also

Name Summary
de.cotech.hw.openpgp.pairedkey.PairedDecryptor

Constructors

Name Summary
PairedEncryptor open fun PairedEncryptor(pairedSecurityKey: PairedSecurityKey)Create an instance parametrized for a PairedSecurityKey.

Functions

Name Summary
encrypt

open fun encrypt(data: ByteSecret): Array<Byte>

Encrypts data for the injected PairedSecurityKey.