botan-bindings-0.0.1.0: Raw Botan bindings
Copyright(c) Leo D 2023
LicenseBSD-3-Clause
Maintainerleo@apotheca.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Botan.Bindings.PubKey

Description

Public key cryptography is a collection of techniques allowing for encryption, signatures, and key agreement.

Synopsis

Documentation

data BotanPrivKeyStruct Source #

Opaque PrivKey struct

botan_privkey_destroy :: FinalizerPtr BotanPrivKeyStruct Source #

Frees all resources of the PrivKey object

pattern BOTAN_PK_RSA :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_SM2 :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ELGAMAL :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_DSA :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ECDSA :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ECKCDSA :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ECGDSA :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_GOST_34_10 :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ED25519 :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_XMSS :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_DH :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_ECDH :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_CURVE25519 :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_DILITHIUM :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_KYBER :: (Eq a, IsString a) => a Source #

pattern BOTAN_PK_MCELIECE :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_10_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_16_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_20_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_10_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_16_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHA2_20_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_10_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_16_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_20_256 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_10_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_16_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_XMSS_SHAKE_20_512 :: (Eq a, IsString a) => a Source #

pattern BOTAN_ECGROUP_GOST_256A :: (Eq a, IsString a) => a Source #

pattern BOTAN_ECGROUP_GOST_512A :: (Eq a, IsString a) => a Source #

pattern BOTAN_EME_RAW :: (Eq a, IsString a) => a Source #

pattern BOTAN_EME_PKCS1_v1_5 :: (Eq a, IsString a) => a Source #

pattern BOTAN_EME_OAEP :: (Eq a, IsString a) => a Source #

pattern BOTAN_MGF_MGF1 :: (Eq a, IsString a) => a Source #

botan_privkey_create Source #

Arguments

:: Ptr BotanPrivKey

key: the new object will be placed here

-> ConstPtr CChar

algo_name: something like RSA or ECDSA

-> ConstPtr CChar

algo_params: is specific to the algorithm. For RSA, specifies the modulus bit length. For ECC is the name of the curve.

-> BotanRNG

rng: a random number generator

-> IO CInt 

Create a new private key

pattern BOTAN_CHECK_KEY_NORMAL_TESTS :: (Eq a, Num a) => a Source #

botan_privkey_check_key Source #

Arguments

:: BotanPrivKey

key

-> BotanRNG

rng

-> Word32

flags

-> IO CInt 

Check the validity of a private key

botan_privkey_load Source #

Arguments

:: Ptr BotanPrivKey

key

-> BotanRNG

rng

-> ConstPtr Word8

bits[]

-> CSize

len

-> ConstPtr CChar

password

-> IO CInt 

Input currently assumed to be PKCS #8 structure; Set password to NULL to indicate no encryption expected Starting in 2.8.0, the rng parameter is unused and may be set to null

botan_privkey_export Source #

Arguments

:: BotanPrivKey

key

-> Ptr Word8

out[]

-> Ptr CSize

out_len

-> Word32

flags

-> IO CInt 

On input *out_len is number of bytes in out[] On output *out_len is number of bytes written (or required) If out is not big enough no output is written, *out_len is set and 1 is returned Returns 0 on success and sets If some other error occurs a negative integer is returned.

botan_privkey_view_der Source #

Arguments

:: BotanPrivKey

key

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewBinCallback ctx)

view

-> IO CInt 

View the private key's DER encoding

botan_privkey_view_pem Source #

Arguments

:: BotanPrivKey

key

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewStrCallback ctx)

view

-> IO CInt 

View the private key's PEM encoding

botan_privkey_algo_name Source #

Arguments

:: BotanPrivKey

key

-> Ptr CChar

out[]

-> Ptr CSize

out_len

-> IO CInt 

botan_privkey_export_encrypted_pbkdf_msec Source #

Arguments

:: BotanPrivKey

key

-> Ptr Word8

out[]

-> Ptr CSize

out_len

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> Word32

pbkdf_msec_runtime

-> Ptr CSize

pbkdf_iterations_out

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> Word32

flags

-> IO CInt 

Export a private key, running PBKDF for specified amount of time

Note: starting in 3.0, the output iterations count is not provided

botan_privkey_export_encrypted_pbkdf_iter Source #

Arguments

:: BotanPrivKey

key

-> Ptr Word8

out[]

-> Ptr CSize

out_len

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> CSize

pbkdf_iterations

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> Word32

flags

-> IO CInt 

Export a private key using the specified number of iterations.

botan_privkey_view_encrypted_der Source #

Arguments

:: BotanPrivKey

key

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> CSize

pbkdf_iterations

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewBinCallback ctx)

view

-> IO CInt 

View the encryption of a private key (binary DER encoding)

Set cipher_algo, pbkdf_algo to NULL to use defaults Set pbkdf_iterations to 0 to use defaults

botan_privkey_view_encrypted_der_timed Source #

Arguments

:: BotanPrivKey

key

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> CSize

pbkdf_runtime_msec

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewBinCallback ctx)

view

-> IO CInt 

View the encryption of a private key (binary DER encoding)

Set cipher_algo, pbkdf_algo to NULL to use defaults

botan_privkey_view_encrypted_pem Source #

Arguments

:: BotanPrivKey

key

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> CSize

pbkdf_iterations

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewStrCallback ctx)

view

-> IO CInt 

View the encryption of a private key (PEM encoding)

Set cipher_algo, pbkdf_algo to NULL to use defaults Set pbkdf_iterations to 0 to use defaults

botan_privkey_view_encrypted_pem_timed Source #

Arguments

:: BotanPrivKey

key

-> BotanRNG

rng

-> ConstPtr CChar

passphrase

-> ConstPtr CChar

cipher_algo

-> ConstPtr CChar

pbkdf_algo

-> CSize

pbkdf_runtime_msec

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewStrCallback ctx)

view

-> IO CInt 

View the encryption of a private key (PEM encoding)

Set cipher_algo, pbkdf_algo to NULL to use defaults

botan_privkey_get_field Source #

Arguments

:: BotanMP

output

-> BotanPrivKey

key

-> ConstPtr CChar

field_name

-> IO CInt 

data BotanPubKeyStruct Source #

Opaque PubKey struct

botan_pubkey_destroy :: FinalizerPtr BotanPubKeyStruct Source #

Frees all resources of the PubKey object

pattern BOTAN_PUBKEY_EXPORT_FLAG_DER :: (Eq a, Num a) => a Source #

pattern BOTAN_PUBKEY_EXPORT_FLAG_PEM :: (Eq a, Num a) => a Source #

botan_pubkey_export Source #

Arguments

:: BotanPubKey

key

-> Ptr Word8

out[]

-> Ptr CSize

out_len

-> Word32

flags

-> IO CInt 

botan_pubkey_view_der Source #

Arguments

:: BotanPubKey

key

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewBinCallback ctx)

view

-> IO CInt 

View the public key's DER encoding

botan_pubkey_algo_name Source #

Arguments

:: BotanPubKey

key

-> Ptr CChar

out[]

-> Ptr CSize

out_len

-> IO CInt 

botan_pubkey_check_key Source #

Arguments

:: BotanPubKey

key

-> BotanRNG

rng

-> Word32

flags

-> IO CInt 

Returns 0 if key is valid, negative if invalid key or some other error

botan_pubkey_get_field Source #

Arguments

:: BotanMP

output

-> BotanPubKey

key

-> ConstPtr CChar

field_name

-> IO CInt 

Get arbitrary named fields from public or private keys

botan_pubkey_view_ec_public_point Source #

Arguments

:: BotanPubKey

key

-> BotanViewContext ctx

ctx

-> FunPtr (BotanViewBinCallback ctx)

view

-> IO CInt 

View the uncompressed public point associated with the key