scoop:scoop.crypto:0.1.0
src/native/keys.scoop
Selected production source · src/native/keys.scoop
1
package scoop.crypto.native3
import scoop.crypto.PrivateKey4
import scoop.crypto.PublicKey6
/**7
* Borrows the native handle of a live PrivateKey. The unsafe caller must keep the owner open8
* 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 open13
* 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): CryptoResult18
@Extern(name = "scoop_crypto_key_algorithm") internal fun keyAlgorithm(handle: ULong): Int19
@Extern(name = "scoop_crypto_key_import") internal fun keyImport(privateKey: Int, pem: Int, data: Ptr<Byte>, count: Long): CryptoResult20
@Extern(name = "scoop_crypto_key_export") internal fun keyExport(handle: ULong, privateKey: Int, pem: Int): CryptoResult21
@Extern(name = "scoop_crypto_public_key") internal fun keyPublic(handle: ULong): CryptoResult22
@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): CryptoResult24
@Extern(name = "scoop_crypto_verify") internal fun keyVerify(algorithm: Int, key: ULong, data: Ptr<Byte>, count: Long, signature: Ptr<Byte>, size: Long): CryptoResult