Scoop API

scoop:scoop.crypto:0.1.0

src/native/keys.scoop

Selected production source · src/native/keys.scoop

1package scoop.crypto.native
3import scoop.crypto.PrivateKey
4import scoop.crypto.PublicKey
6/**
7 * Borrows the native handle of a live PrivateKey. The unsafe caller must keep the owner open
8 * throughout native use and must not free the borrowed handle.
9 */
10@Unsafe public fun privateKeyHandle(key: PrivateKey): ULong = key.nativeHandle()
11/**
12 * Borrows the native handle of a live PublicKey. The unsafe caller must keep the owner open
13 * throughout native use and must not free the borrowed handle.
14 */
15@Unsafe public fun publicKeyHandle(key: PublicKey): ULong = key.nativeHandle()
17@Extern(name = "scoop_crypto_key_generate") internal fun keyGenerate(algorithm: Int, bits: Int): CryptoResult
18@Extern(name = "scoop_crypto_key_algorithm") internal fun keyAlgorithm(handle: ULong): Int
19@Extern(name = "scoop_crypto_key_import") internal fun keyImport(privateKey: Int, pem: Int, data: Ptr<Byte>, count: Long): CryptoResult
20@Extern(name = "scoop_crypto_key_export") internal fun keyExport(handle: ULong, privateKey: Int, pem: Int): CryptoResult
21@Extern(name = "scoop_crypto_public_key") internal fun keyPublic(handle: ULong): CryptoResult
22@Extern(name = "scoop_crypto_key_free") internal fun keyFree(handle: ULong)
23@Extern(name = "scoop_crypto_sign") internal fun keySign(algorithm: Int, key: ULong, data: Ptr<Byte>, count: Long): CryptoResult
24@Extern(name = "scoop_crypto_verify") internal fun keyVerify(algorithm: Int, key: ULong, data: Ptr<Byte>, count: Long, signature: Ptr<Byte>, size: Long): CryptoResult