Portability | Good |
---|---|
Stability | experimental |
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Safe Haskell | None |
- pad :: CPRG g => g -> Int -> ByteString -> Either Error (ByteString, g)
- padSignature :: Int -> ByteString -> Either Error ByteString
- unpad :: ByteString -> Either Error ByteString
- decrypt :: Maybe Blinder -> PrivateKey -> ByteString -> Either Error ByteString
- decryptSafer :: CPRG g => g -> PrivateKey -> ByteString -> (Either Error ByteString, g)
- sign :: Maybe Blinder -> HashDescr -> PrivateKey -> ByteString -> Either Error ByteString
- signSafer :: CPRG g => g -> HashDescr -> PrivateKey -> ByteString -> (Either Error ByteString, g)
- encrypt :: CPRG g => g -> PublicKey -> ByteString -> (Either Error ByteString, g)
- verify :: HashDescr -> PublicKey -> ByteString -> ByteString -> Bool
padding and unpadding
pad :: CPRG g => g -> Int -> ByteString -> Either Error (ByteString, g)Source
This produce a standard PKCS1.5 padding for encryption
padSignature :: Int -> ByteString -> Either Error ByteStringSource
Produce a standard PKCS1.5 padding for signature
unpad :: ByteString -> Either Error ByteStringSource
Try to remove a standard PKCS1.5 encryption padding.
private key operations
:: Maybe Blinder | optional blinder |
-> PrivateKey | RSA private key |
-> ByteString | cipher text |
-> Either Error ByteString |
decrypt message using the private key.
When the decryption is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None.
If unsure always set a blinder or use decryptSafer
:: CPRG g | |
=> g | random generator |
-> PrivateKey | RSA private key |
-> ByteString | cipher text |
-> (Either Error ByteString, g) |
decrypt message using the private key and by automatically generating a blinder.
:: Maybe Blinder | optional blinder |
-> HashDescr | hash descriptor |
-> PrivateKey | private key |
-> ByteString | message to sign |
-> Either Error ByteString |
sign message using private key, a hash and its ASN1 description
When the signature is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None.
If unsure always set a blinder or use signSafer
:: CPRG g | |
=> g | random generator |
-> HashDescr | Hash descriptor |
-> PrivateKey | private key |
-> ByteString | message to sign |
-> (Either Error ByteString, g) |
sign message using the private key and by automatically generating a blinder.
public key operations
encrypt :: CPRG g => g -> PublicKey -> ByteString -> (Either Error ByteString, g)Source
encrypt a bytestring using the public key and a CPRG random generator.
the message need to be smaller than the key size - 11
verify :: HashDescr -> PublicKey -> ByteString -> ByteString -> BoolSource
verify message with the signed message