crypto-pubkey-openssh 0.2.5 → 0.2.6
raw patch · 4 files changed
+17/−14 lines, 4 filesdep ~QuickCheckdep ~attoparsec
Dependency ranges changed: QuickCheck, attoparsec
Files
- crypto-pubkey-openssh.cabal +4/−4
- src/Crypto/PubKey/OpenSsh.hs +4/−1
- src/Crypto/PubKey/OpenSsh/Decode.hs +2/−5
- src/Crypto/PubKey/OpenSsh/Types.hs +7/−4
crypto-pubkey-openssh.cabal view
@@ -1,5 +1,5 @@ Name: crypto-pubkey-openssh-Version: 0.2.5+Version: 0.2.6 Synopsis: OpenSSH keys decoder/encoder Description: OpenSSH keys decoder/encoder License: MIT@@ -29,7 +29,7 @@ , bytestring == 0.10.* || == 0.9.* , base64-bytestring == 1.0.* , cereal == 0.4.*- , attoparsec == 0.11.* || == 0.10.*+ , attoparsec >= 0.10 , crypto-pubkey-types == 0.4.* , pem == 0.2.* , asn1-types == 0.2.*@@ -53,7 +53,7 @@ , bytestring == 0.10.* || == 0.9.* , base64-bytestring == 1.0.* , cereal == 0.4.*- , attoparsec == 0.11.* || == 0.10.*+ , attoparsec >= 0.10 , crypto-pubkey-types == 0.4.* , pem == 0.2.* , asn1-types == 0.2.*@@ -61,7 +61,7 @@ , tasty == 0.8.* , tasty-quickcheck == 0.8.*- , QuickCheck == 2.6.*+ , QuickCheck >= 2.6 , temporary == 1.2.* || == 1.1.* , process == 1.2.* , filepath == 1.3.*
src/Crypto/PubKey/OpenSsh.hs view
@@ -1,8 +1,11 @@ module Crypto.PubKey.OpenSsh- ( OpenSshPublicKey(..)+ ( -- * Types+ OpenSshPublicKey(..) , OpenSshPrivateKey(..)+ -- * Encoding , encodePublic , decodePublic+ -- * Decoding , encodePrivate , decodePrivate ) where
src/Crypto/PubKey/OpenSsh/Decode.hs view
@@ -9,7 +9,7 @@ import Data.ByteString.Char8 (ByteString) import Data.Char (isControl) -import Data.Attoparsec.ByteString.Char8 (Parser, parseOnly, take, space,+import Data.Attoparsec.ByteString.Char8 (Parser, parseOnly, space, isSpace, takeTill) import Data.PEM (PEM(..), pemParseBS) import Data.ASN1.Encoding (decodeASN1')@@ -23,9 +23,6 @@ import Crypto.PubKey.OpenSsh.Types (OpenSshKeyType(..), OpenSshPublicKey(..), OpenSshPrivateKey(..)) -typeSize :: Int-typeSize = 7- readType :: Monad m => ByteString -> m OpenSshKeyType readType "ssh-rsa" = return OpenSshKeyTypeRsa readType "ssh-dss" = return OpenSshKeyTypeDsa@@ -64,7 +61,7 @@ openSshPublicKeyParser :: Parser OpenSshPublicKey openSshPublicKeyParser = do- void $ readType =<< take typeSize+ void $ readType =<< takeTill isSpace void space b64 <- takeTill isSpace binary <- either fail return $ Base64.decode b64
src/Crypto/PubKey/OpenSsh/Types.hs view
@@ -1,3 +1,5 @@+{- OPTIONS_GHC -funbox-strict-fields -}+ module Crypto.PubKey.OpenSsh.Types where import Data.ByteString (ByteString)@@ -5,12 +7,13 @@ import qualified Crypto.Types.PubKey.DSA as DSA import qualified Crypto.Types.PubKey.RSA as RSA -data OpenSshPrivateKey = OpenSshPrivateKeyRsa RSA.PrivateKey- | OpenSshPrivateKeyDsa DSA.PrivateKey DSA.PublicNumber+data OpenSshPrivateKey = OpenSshPrivateKeyRsa !RSA.PrivateKey+ | OpenSshPrivateKeyDsa !DSA.PrivateKey !DSA.PublicNumber deriving (Eq, Show) -data OpenSshPublicKey = OpenSshPublicKeyRsa RSA.PublicKey ByteString- | OpenSshPublicKeyDsa DSA.PublicKey ByteString+-- | Public key contains `RSA` or `DSA` key and OpenSSH key description+data OpenSshPublicKey = OpenSshPublicKeyRsa !RSA.PublicKey !ByteString+ | OpenSshPublicKeyDsa !DSA.PublicKey !ByteString deriving (Eq, Show) data OpenSshKeyType = OpenSshKeyTypeRsa