| Copyright | (c) Joseph Abrahamson 2013 |
|---|---|
| License | MIT |
| Maintainer | me@jspha.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Saltine.Core.Sign
Description
The newKeypair function randomly generates a secret key and a
corresponding public key. The sign function signs a message
ByteString using the signer's secret key and returns the
resulting signed message. The signOpen function verifies the
signature in a signed message using the signer's public key then
returns the message without its signature.
Crypto.Saltine.Core.Sign is an EdDSA signature using elliptic-curve Curve25519 (see: http://ed25519.cr.yp.to/). See also, "Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe, Bo-Yin Yang. High-speed high-security signatures. Journal of Cryptographic Engineering 2 (2012), 77–89." http://ed25519.cr.yp.to/ed25519-20110926.pdf.
This is current information as of 2013 June 6.
Synopsis
- data SecretKey
- data PublicKey
- type Keypair = (SecretKey, PublicKey)
- newKeypair :: IO Keypair
- sign :: SecretKey -> ByteString -> ByteString
- signOpen :: PublicKey -> ByteString -> Maybe ByteString
- signDetached :: SecretKey -> ByteString -> ByteString
- signVerifyDetached :: PublicKey -> ByteString -> ByteString -> Bool
Documentation
An opaque box cryptographic secret key.
Instances
| Eq SecretKey Source # | |
| Data SecretKey Source # | |
Defined in Crypto.Saltine.Core.Sign Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SecretKey -> c SecretKey # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SecretKey # toConstr :: SecretKey -> Constr # dataTypeOf :: SecretKey -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SecretKey) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SecretKey) # gmapT :: (forall b. Data b => b -> b) -> SecretKey -> SecretKey # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SecretKey -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SecretKey -> r # gmapQ :: (forall d. Data d => d -> u) -> SecretKey -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SecretKey -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SecretKey -> m SecretKey # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SecretKey -> m SecretKey # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SecretKey -> m SecretKey # | |
| Ord SecretKey Source # | |
| Generic SecretKey Source # | |
| Hashable SecretKey Source # | |
Defined in Crypto.Saltine.Core.Sign | |
| IsEncoding SecretKey Source # | |
Defined in Crypto.Saltine.Core.Sign Methods encode :: SecretKey -> ByteString Source # decode :: ByteString -> Maybe SecretKey Source # encoded :: (Choice p, Applicative f) => p SecretKey (f SecretKey) -> p ByteString (f ByteString) Source # | |
| type Rep SecretKey Source # | |
Defined in Crypto.Saltine.Core.Sign type Rep SecretKey = D1 ('MetaData "SecretKey" "Crypto.Saltine.Core.Sign" "saltine-0.1.1.1-KbVmRAcWBV25w8Dlelbdig" 'True) (C1 ('MetaCons "SK" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
An opaque box cryptographic public key.
Instances
| Eq PublicKey Source # | |
| Data PublicKey Source # | |
Defined in Crypto.Saltine.Core.Sign Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PublicKey -> c PublicKey # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PublicKey # toConstr :: PublicKey -> Constr # dataTypeOf :: PublicKey -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PublicKey) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PublicKey) # gmapT :: (forall b. Data b => b -> b) -> PublicKey -> PublicKey # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r # gmapQ :: (forall d. Data d => d -> u) -> PublicKey -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PublicKey -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey # | |
| Ord PublicKey Source # | |
| Generic PublicKey Source # | |
| Hashable PublicKey Source # | |
Defined in Crypto.Saltine.Core.Sign | |
| IsEncoding PublicKey Source # | |
Defined in Crypto.Saltine.Core.Sign Methods encode :: PublicKey -> ByteString Source # decode :: ByteString -> Maybe PublicKey Source # encoded :: (Choice p, Applicative f) => p PublicKey (f PublicKey) -> p ByteString (f ByteString) Source # | |
| type Rep PublicKey Source # | |
Defined in Crypto.Saltine.Core.Sign type Rep PublicKey = D1 ('MetaData "PublicKey" "Crypto.Saltine.Core.Sign" "saltine-0.1.1.1-KbVmRAcWBV25w8Dlelbdig" 'True) (C1 ('MetaCons "PK" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
newKeypair :: IO Keypair Source #
Arguments
| :: SecretKey | |
| -> ByteString | Message |
| -> ByteString | Signed message |
Augments a message with a signature forming a "signed message".
Arguments
| :: PublicKey | |
| -> ByteString | Signed message |
| -> Maybe ByteString | Maybe the restored message |
Arguments
| :: SecretKey | |
| -> ByteString | Message |
| -> ByteString | Signature |
Returns just the signature for a message using a SecretKey.
Arguments
| :: PublicKey | |
| -> ByteString | Signature |
| -> ByteString | Message |
| -> Bool |
Returns True if the signature is valid for the given public key and
message.