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

Botan.Low.PubKey

Description

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

Synopsis

Private keys

newtype PrivKey Source #

Constructors

MkPrivKey 

Fields

withPrivKey :: PrivKey -> (BotanPrivKey -> IO a) -> IO a Source #

privKeyCreate Source #

Arguments

:: ByteString

algo_name: something like RSA or ECDSA

-> ByteString

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

-> RNG

rng: a random number generator

-> IO PrivKey

key: the new object will be placed here

Create a new private key

privKeyLoad Source #

Arguments

:: ByteString

bits[]

-> ByteString

password

-> IO PrivKey

key

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

privKeyAlgoName Source #

Arguments

:: PrivKey

key

-> IO ByteString

out[]

View the private key's DER encoding privKeyViewDER :: BotanPrivKey -- ^ key -> BotanViewContext ctx -- ^ ctx -> FunPtr (BotanViewBinCallback ctx) -- ^ view -> IO CInt

View the private key's PEM encoding privKeyViewPEM :: BotanPrivKey -- ^ key -> BotanViewContext ctx -- ^ ctx -> FunPtr (BotanViewStrCallback ctx) -- ^ view -> IO CInt

privKeyCheckKey Source #

Arguments

:: PrivKey

key

-> RNG

rng

-> CheckKeyFlags

flags

-> IO () 

Check the validity of a private key

privKeyGetField Source #

Arguments

:: MP

output

-> PrivKey

key

-> ByteString

field_name

-> IO () 

Get arbitrary named fields from public or private keys

privKeyExport Source #

Arguments

:: PrivKey

key

-> PrivKeyExportFlags

flags

-> IO ByteString

out[]

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.

Public Keys

newtype PubKey Source #

Constructors

MkPubKey 

Fields

withPubKey :: PubKey -> (BotanPubKey -> IO a) -> IO a Source #

pubKeyLoad Source #

Arguments

:: ByteString

bits[]

-> IO PubKey

key

pubKeyAlgoName Source #

Arguments

:: PubKey

key

-> IO ByteString

out[]

pubKeyCheckKey Source #

Arguments

:: PubKey

key

-> RNG

rng

-> CheckKeyFlags

flags

-> IO Bool 

pubKeyEstimatedStrength Source #

Arguments

:: PubKey

key

-> IO Int

estimate

pubKeyGetField Source #

Arguments

:: MP

output

-> PubKey

key

-> ByteString

field_name

-> IO () 

Get arbitrary named fields from public or private keys

pubKeyExport Source #

Arguments

:: PubKey

key

-> PubKeyExportFlags

flags

-> IO ByteString

out[]

PK Algorithms

pattern RSA :: PKName Source #

pattern SM2 :: PKName Source #

pattern ElGamal :: PKName Source #

pattern DSA :: PKName Source #

pattern ECDSA :: PKName Source #

pattern ECKCDSA :: PKName Source #

pattern ECGDSA :: PKName Source #

pattern Ed25519 :: PKName Source #

pattern XMSS :: PKName Source #

pattern DH :: PKName Source #

pattern ECDH :: PKName Source #

pattern Kyber :: PKName Source #

pattern McEliece :: PKName Source #

DLGroup

ECGroup

XMSS

EME

type EMEName = ByteString Source #

Encoding Method for Encryption

WARNING: Name is not completely accurate, may be changed to PKEncryptParams

pattern EME_RAW :: EMEName Source #

EMSA

type EMSAName = ByteString Source #

Encoding Method for Signature with Appendix

WARNING: Name is not completely accurate, may be changed to PKSignParams

Convenience

createPrivKey :: (Ptr BotanPrivKey -> IO CInt) -> IO PrivKey Source #

createPubKey :: (Ptr BotanPubKey -> IO CInt) -> IO PubKey Source #

mkPrivKeyLoad1_name :: (Ptr BotanPrivKey -> BotanMP -> ConstPtr CChar -> IO BotanErrorCode) -> MP -> ByteString -> IO PrivKey Source #

mkPrivKeyLoad3 :: (Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> IO BotanErrorCode) -> MP -> MP -> MP -> IO PrivKey Source #

mkPrivKeyLoad4 :: (Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO BotanErrorCode) -> MP -> MP -> MP -> MP -> IO PrivKey Source #

mkPubKeyLoad2 :: (Ptr BotanPubKey -> BotanMP -> BotanMP -> IO BotanErrorCode) -> MP -> MP -> IO PubKey Source #

mkPubKeyLoad2_name :: (Ptr BotanPubKey -> BotanMP -> BotanMP -> ConstPtr CChar -> IO BotanErrorCode) -> MP -> MP -> ByteString -> IO PubKey Source #

mkPubKeyLoad3 :: (Ptr BotanPubKey -> BotanMP -> BotanMP -> BotanMP -> IO BotanErrorCode) -> MP -> MP -> MP -> IO PubKey Source #

mkPubKeyLoad4 :: (Ptr BotanPubKey -> BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO BotanErrorCode) -> MP -> MP -> MP -> MP -> IO PubKey Source #