Safe Haskell | None |
---|---|
Language | Haskell2010 |
Key types, derivations, and related functionality for SDMF.
See docsspecificationsmutable.rst for details.
Synopsis
- newtype KeyPair = KeyPair {}
- toPublicKey :: KeyPair -> PublicKey
- toSignatureKey :: KeyPair -> Signature
- toVerificationKey :: KeyPair -> Verification
- newtype Verification = Verification {}
- newtype Signature = Signature {}
- data Write = Write {}
- data Read = Read {}
- newtype StorageIndex = StorageIndex {}
- newtype WriteEnablerMaster = WriteEnablerMaster ScrubbedBytes
- newtype WriteEnabler = WriteEnabler ScrubbedBytes
- data Data = Data {}
- newtype SDMF_IV = SDMF_IV (IV AES128)
- keyPairBits :: Int
- keyLength :: Int
- newKeyPair :: MonadRandom m => m KeyPair
- deriveWriteKey :: Signature -> Maybe Write
- mutableWriteKeyTag :: ByteString
- deriveReadKey :: Write -> Maybe Read
- mutableReadKeyTag :: ByteString
- deriveDataKey :: SDMF_IV -> Read -> Maybe Data
- mutableDataKeyTag :: ByteString
- deriveStorageIndex :: Read -> StorageIndex
- mutableStorageIndexTag :: ByteString
- deriveWriteEnablerMaster :: Write -> WriteEnablerMaster
- mutableWriteEnablerMasterTag :: ByteString
- deriveWriteEnabler :: ByteString -> WriteEnablerMaster -> WriteEnabler
- mutableWriteEnablerTag :: ByteString
- deriveVerificationHash :: Verification -> ByteString
- mutableVerificationKeyHashTag :: ByteString
- verificationKeyToBytes :: Verification -> ByteString
- signatureKeyToBytes :: Signature -> ByteString
- signatureKeyFromBytes :: ByteString -> Either String Signature
- encryptSignatureKey :: Write -> Signature -> ByteString
- shorten :: Int -> Text -> Text
- showBase32 :: ByteString -> Text
Documentation
toPublicKey :: KeyPair -> PublicKey Source #
toSignatureKey :: KeyPair -> Signature Source #
newtype Verification Source #
Instances
Eq Verification Source # | |
Defined in Tahoe.SDMF.Internal.Keys (==) :: Verification -> Verification -> Bool # (/=) :: Verification -> Verification -> Bool # | |
Show Verification Source # | |
Defined in Tahoe.SDMF.Internal.Keys showsPrec :: Int -> Verification -> ShowS # show :: Verification -> String # showList :: [Verification] -> ShowS # |
newtype StorageIndex Source #
Instances
Eq StorageIndex Source # | |
Defined in Tahoe.SDMF.Internal.Keys (==) :: StorageIndex -> StorageIndex -> Bool # (/=) :: StorageIndex -> StorageIndex -> Bool # | |
Ord StorageIndex Source # | |
Defined in Tahoe.SDMF.Internal.Keys compare :: StorageIndex -> StorageIndex -> Ordering # (<) :: StorageIndex -> StorageIndex -> Bool # (<=) :: StorageIndex -> StorageIndex -> Bool # (>) :: StorageIndex -> StorageIndex -> Bool # (>=) :: StorageIndex -> StorageIndex -> Bool # max :: StorageIndex -> StorageIndex -> StorageIndex # min :: StorageIndex -> StorageIndex -> StorageIndex # | |
Show StorageIndex Source # | |
Defined in Tahoe.SDMF.Internal.Keys showsPrec :: Int -> StorageIndex -> ShowS # show :: StorageIndex -> String # showList :: [StorageIndex] -> ShowS # |
newtype WriteEnabler Source #
keyPairBits :: Int Source #
The size of the public/private key pair to generate.
newKeyPair :: MonadRandom m => m KeyPair Source #
Create a new, random key pair (publicprivate aka verificationsignature) of the appropriate type and size for SDMF encryption.
deriveWriteKey :: Signature -> Maybe Write Source #
Compute the write key for a given signature key for an SDMF share.
deriveReadKey :: Write -> Maybe Read Source #
Compute the read key for a given write key for an SDMF share.
deriveDataKey :: SDMF_IV -> Read -> Maybe Data Source #
Compute the data encryption/decryption key for a given read key for an SDMF share.
deriveStorageIndex :: Read -> StorageIndex Source #
Compute the storage index for a given read key for an SDMF share.
deriveWriteEnablerMaster :: Write -> WriteEnablerMaster Source #
Derive the "write enabler master" secret for a given write key for an SDMF share.
deriveWriteEnabler :: ByteString -> WriteEnablerMaster -> WriteEnabler Source #
Derive the "write enabler" secret for a given peer and "write enabler master" for an SDMF share.
deriveVerificationHash :: Verification -> ByteString Source #
Compute the verification key hash of the given verification key for inclusion in an SDMF share.
mutableVerificationKeyHashTag :: ByteString Source #
The tag used when hashing the verification key to the verification key hash for inclusion in SDMF shares.
verificationKeyToBytes :: Verification -> ByteString Source #
Encode a public key to the Tahoe-LAFS canonical bytes representation - X.509 SubjectPublicKeyInfo of the ASN.1 DER serialization of an RSA PublicKey.
signatureKeyToBytes :: Signature -> ByteString Source #
Encode a private key to the Tahoe-LAFS canonical bytes representation - X.509 SubjectPublicKeyInfo of the ASN.1 DER serialization of an RSA PublicKey.
signatureKeyFromBytes :: ByteString -> Either String Signature Source #
Decode a private key from the Tahoe-LAFS canonical bytes representation.
encryptSignatureKey :: Write -> Signature -> ByteString Source #
Encrypt the signature key for inclusion in the SDMF share itself.
shorten :: Int -> Text -> Text Source #
Replace most of the tail of a string with a short placeholder. If the
string is not much longer than n
then the result might not actually be
shorter.
TODO: Deduplicate this between here and tahoe-chk.
showBase32 :: ByteString -> Text Source #