CryptoOperations

@Singleton
class CryptoOperations @Inject constructor

Singleton coordinator that delegates to individual engine helpers.

Each public function corresponds to one OpenPGP/S-MIME primitive and simply builds the matching engine request. Callers pass raw byte/char material; zeroing of passphrase buffers remains the responsibility of the caller.

Constructors

Link copied to clipboard
@Inject
constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun addSubkey(secretArmored: ByteArray, passphrase: CharArray, subkeyType: SubkeyType, rsaBits: Int = 3072): ByteArray

Adds a subkey of subkeyType to an existing secret key ring.

Link copied to clipboard
fun addUserId(secretArmored: ByteArray, passphrase: CharArray, userId: String): ByteArray

Adds a new userId identity to the secret key ring.

Link copied to clipboard
fun certifyKey(certifierSecretArmored: ByteArray, certifierPassphrase: CharArray, targetPublicArmored: ByteArray, userId: String): CertifyKeyResult

Certifies (signs) userId on targetPublicArmored using the certifier's secret key, establishing a trust signature.

Link copied to clipboard
fun changePassphrase(secretArmored: ByteArray, oldPassphrase: CharArray, newPassphrase: CharArray): ByteArray

Re-encrypts the secret key ring, replacing oldPassphrase with newPassphrase.

Link copied to clipboard
fun decrypt(ciphertext: ByteArray, secretArmored: ByteArray, passphrase: CharArray): DecryptResult

Decrypts ciphertext using the given secret key ring and passphrase.

Link copied to clipboard
fun decryptTar(ciphertext: ByteArray, secretArmored: ByteArray, passphrase: CharArray): List<NamedFile>

Decrypts a GnuPG encrypted tar back into its constituent NamedFiles.

Link copied to clipboard
fun encrypt(plaintext: ByteArray, recipientPublicArmored: List<ByteArray>, asciiArmor: Boolean = true, fileName: String = "_CONSOLE"): EncryptResult

Encrypts plaintext to one or more recipients.

Link copied to clipboard
fun encryptTar(files: List<NamedFile>, recipientPublicArmored: List<ByteArray>, asciiArmor: Boolean = true): EncryptResult

Encrypts a set of files into a single GnuPG-compatible encrypted tar.

Link copied to clipboard
fun generateKey(userId: String, passphrase: CharArray, algorithmType: KeyAlgorithmType = KeyAlgorithmType.RSA, rsaBits: Int = 3072): GeneratedKeyRing

Generates a new secret/public key ring for userId.

Link copied to clipboard
fun generateRevocationCert(secretArmored: ByteArray, passphrase: CharArray, reasonText: String = ""): ByteArray

Produces a revocation certificate for the secret key, with optional reasonText.

Link copied to clipboard
fun sign(data: ByteArray, secretArmored: ByteArray, passphrase: CharArray, detachedBinary: Boolean = false): SignResult

Signs data with the given secret key.

Link copied to clipboard
fun smimeDecrypt(ciphertext: ByteArray): ByteArray

Decrypts ciphertext using the S/MIME engine.

Link copied to clipboard

Encrypts plaintext using the S/MIME engine.

Link copied to clipboard
fun symmetricDecrypt(ciphertext: ByteArray, password: CharArray): ByteArray

Password-based (symmetric) decryption of ciphertext.

Link copied to clipboard
fun symmetricEncrypt(plaintext: ByteArray, password: CharArray): ByteArray

Password-based (symmetric) encryption of plaintext.

Link copied to clipboard
fun verify(signedData: ByteArray, publicArmored: List<ByteArray>, message: ByteArray? = null, binaryDocument: Boolean = false): VerifyResult

Verifies a signature against candidate public keys.