HsOpenSSL-0.11.7.9: Partial OpenSSL binding for Haskell

Safe Haskell | None
Language | Haskell2010

OpenSSL.EVP.Internal

Synopsis

- newtype Cipher = Cipher (Ptr EVP_CIPHER)
- data EVP_CIPHER
- withCipherPtr :: Cipher -> (Ptr EVP_CIPHER -> IO a) -> IO a
- cipherIvLength :: Cipher -> Int
- newtype CipherCtx = CipherCtx (ForeignPtr EVP_CIPHER_CTX)
- data EVP_CIPHER_CTX
- newCipherCtx :: IO CipherCtx
- withCipherCtxPtr :: CipherCtx -> (Ptr EVP_CIPHER_CTX -> IO a) -> IO a
- withNewCipherCtxPtr :: (Ptr EVP_CIPHER_CTX -> IO a) -> IO a
- data CryptoMode
  - = Encrypt
  - | Decrypt
- cipherSetPadding :: CipherCtx -> Int -> IO CipherCtx
- cipherInitBS :: Cipher -> ByteString -> ByteString -> CryptoMode -> IO CipherCtx
- cipherUpdateBS :: CipherCtx -> ByteString -> IO ByteString
- cipherFinalBS :: CipherCtx -> IO ByteString
- cipherStrictly :: CipherCtx -> ByteString -> IO ByteString
- cipherLazily :: CipherCtx -> ByteString -> IO ByteString
- newtype Digest = Digest (Ptr EVP_MD)
- data EVP_MD
- withMDPtr :: Digest -> (Ptr EVP_MD -> IO a) -> IO a
- newtype DigestCtx = DigestCtx (ForeignPtr EVP_MD_CTX)
- data EVP_MD_CTX
- withDigestCtxPtr :: DigestCtx -> (Ptr EVP_MD_CTX -> IO a) -> IO a
- digestUpdateBS :: DigestCtx -> ByteString -> IO ()
- digestFinalBS :: DigestCtx -> IO ByteString
- digestFinal :: DigestCtx -> IO String
- digestStrictly :: Digest -> ByteString -> IO DigestCtx
- digestLazily :: Digest -> ByteString -> IO DigestCtx
- newtype HmacCtx = HmacCtx (ForeignPtr HMAC_CTX)
- data HMAC_CTX
- withHmacCtxPtr :: HmacCtx -> (Ptr HMAC_CTX -> IO a) -> IO a
- hmacUpdateBS :: HmacCtx -> ByteString -> IO ()
- hmacFinalBS :: HmacCtx -> IO ByteString
- hmacLazily :: Digest -> ByteString -> ByteString -> IO HmacCtx
- newtype VaguePKey = VaguePKey (ForeignPtr EVP_PKEY)
- data EVP_PKEY
- class PKey k where
  - toPKey :: k -> IO VaguePKey
  - fromPKey :: VaguePKey -> IO (Maybe k)
  - pkeySize :: k -> Int
  - pkeyDefaultMD :: k -> IO Digest
- createPKey :: (Ptr EVP_PKEY -> IO a) -> IO VaguePKey
- wrapPKeyPtr :: Ptr EVP_PKEY -> IO VaguePKey
- withPKeyPtr :: VaguePKey -> (Ptr EVP_PKEY -> IO a) -> IO a
- withPKeyPtr' :: PKey k => k -> (Ptr EVP_PKEY -> IO a) -> IO a
- unsafePKeyToPtr :: VaguePKey -> Ptr EVP_PKEY
- touchPKey :: VaguePKey -> IO ()

# Documentation

newtype Cipher Source #

`Cipher` is an opaque object that represents an algorithm of symmetric cipher.

Constructors

Cipher (Ptr EVP_CIPHER) |

data EVP_CIPHER Source #

withCipherPtr :: Cipher -> (Ptr EVP_CIPHER -> IO a) -> IO a Source #

cipherIvLength :: Cipher -> Int Source #

newtype CipherCtx Source #

Constructors

CipherCtx (ForeignPtr EVP_CIPHER_CTX) |

data EVP_CIPHER_CTX Source #

newCipherCtx :: IO CipherCtx Source #

withCipherCtxPtr :: CipherCtx -> (Ptr EVP_CIPHER_CTX -> IO a) -> IO a Source #

withNewCipherCtxPtr :: (Ptr EVP_CIPHER_CTX -> IO a) -> IO a Source #

data CryptoMode Source #

`CryptoMode` represents instruction to `cipher` and such like.

Constructors

Encrypt |
Decrypt |

cipherSetPadding :: CipherCtx -> Int -> IO CipherCtx Source #

cipherInitBS Source #

Arguments

:: Cipher |
-> ByteString | key
-> ByteString | IV
-> CryptoMode |
-> IO CipherCtx |

cipherUpdateBS :: CipherCtx -> ByteString -> IO ByteString Source #

cipherFinalBS :: CipherCtx -> IO ByteString Source #

cipherStrictly :: CipherCtx -> ByteString -> IO ByteString Source #

cipherLazily :: CipherCtx -> ByteString -> IO ByteString Source #

newtype Digest Source #

`Digest` is an opaque object that represents an algorithm of message digest.

Constructors

Digest (Ptr EVP_MD) |

data EVP_MD Source #

withMDPtr :: Digest -> (Ptr EVP_MD -> IO a) -> IO a Source #

newtype DigestCtx Source #

Constructors

DigestCtx (ForeignPtr EVP_MD_CTX) |

data EVP_MD_CTX Source #

withDigestCtxPtr :: DigestCtx -> (Ptr EVP_MD_CTX -> IO a) -> IO a Source #

digestUpdateBS :: DigestCtx -> ByteString -> IO () Source #

digestFinalBS :: DigestCtx -> IO ByteString Source #

digestFinal :: DigestCtx -> IO String Source #

digestStrictly :: Digest -> ByteString -> IO DigestCtx Source #

digestLazily :: Digest -> ByteString -> IO DigestCtx Source #

newtype HmacCtx Source #

Constructors

HmacCtx (ForeignPtr HMAC_CTX) |

data HMAC_CTX Source #

withHmacCtxPtr :: HmacCtx -> (Ptr HMAC_CTX -> IO a) -> IO a Source #

hmacUpdateBS :: HmacCtx -> ByteString -> IO () Source #

hmacFinalBS :: HmacCtx -> IO ByteString Source #

hmacLazily :: Digest -> ByteString -> ByteString -> IO HmacCtx Source #

newtype VaguePKey Source #

VaguePKey is a `ForeignPtr` to `EVP_PKEY`, that is either public key or a ker pair. We can't tell which at compile time.

Constructors

VaguePKey (ForeignPtr EVP_PKEY) |

data EVP_PKEY Source #

class PKey k where Source #

Instances of class `PKey` can be converted back and forth to `VaguePKey`.

Methods

toPKey :: k -> IO VaguePKey Source #

Wrap the key (i.g. RSA) into `EVP_PKEY`.

fromPKey :: VaguePKey -> IO (Maybe k) Source #

Extract the concrete key from the `EVP_PKEY`. Returns `Nothing` if the type mismatches.

pkeySize :: k -> Int Source #

Do the same as EVP_PKEY_size().

pkeyDefaultMD :: k -> IO Digest Source #

Return the default digesting algorithm for the key.

#### Instances

Instances details

PKey DSAKeyPair Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: DSAKeyPair -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe DSAKeyPair) Source # pkeySize :: DSAKeyPair -> Int Source # pkeyDefaultMD :: DSAKeyPair -> IO Digest Source #
PKey DSAPubKey Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: DSAPubKey -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe DSAPubKey) Source # pkeySize :: DSAPubKey -> Int Source # pkeyDefaultMD :: DSAPubKey -> IO Digest Source #
PKey SomeKeyPair Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: SomeKeyPair -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe SomeKeyPair) Source # pkeySize :: SomeKeyPair -> Int Source # pkeyDefaultMD :: SomeKeyPair -> IO Digest Source #
PKey SomePublicKey Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: SomePublicKey -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe SomePublicKey) Source # pkeySize :: SomePublicKey -> Int Source # pkeyDefaultMD :: SomePublicKey -> IO Digest Source #
PKey RSAKeyPair Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: RSAKeyPair -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe RSAKeyPair) Source # pkeySize :: RSAKeyPair -> Int Source # pkeyDefaultMD :: RSAKeyPair -> IO Digest Source #
PKey RSAPubKey Source # |
Instance details Defined in OpenSSL.EVP.PKey Methods toPKey :: RSAPubKey -> IO VaguePKey Source # fromPKey :: VaguePKey -> IO (Maybe RSAPubKey) Source # pkeySize :: RSAPubKey -> Int Source # pkeyDefaultMD :: RSAPubKey -> IO Digest Source #

createPKey :: (Ptr EVP_PKEY -> IO a) -> IO VaguePKey Source #

wrapPKeyPtr :: Ptr EVP_PKEY -> IO VaguePKey Source #

withPKeyPtr :: VaguePKey -> (Ptr EVP_PKEY -> IO a) -> IO a Source #

withPKeyPtr' :: PKey k => k -> (Ptr EVP_PKEY -> IO a) -> IO a Source #

unsafePKeyToPtr :: VaguePKey -> Ptr EVP_PKEY Source #

touchPKey :: VaguePKey -> IO () Source #