Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tahoe-ssk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
PrivateStorage
tahoe-ssk
Commits
19b3e97c
Commit
19b3e97c
authored
2 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
un-nail AES128 with ScopedTypeVariables and explicit forall
parent
72bddb2d
No related branches found
No related tags found
1 merge request
!7
Implement enough encryption and encoding to be able to read plaintext from Tahoe-LAFS-generated SDMF shares
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Tahoe/SDMF/Internal/Encoding.hs
+4
-4
4 additions, 4 deletions
src/Tahoe/SDMF/Internal/Encoding.hs
with
4 additions
and
4 deletions
src/Tahoe/SDMF/Internal/Encoding.hs
+
4
−
4
View file @
19b3e97c
{-# LANGUAGE ScopedTypeVariables #-}
{- | Implement the scheme for encoding ciphertext into SDMF shares (and
decoding it again).
-}
module
Tahoe.SDMF.Internal.Encoding
where
import
Control.Monad.IO.Class
(
MonadIO
(
liftIO
))
import
Crypto.Cipher.AES
(
AES128
)
import
Crypto.Cipher.Types
(
BlockCipher
(
blockSize
),
IV
,
makeIV
)
import
Crypto.Random
(
MonadRandom
(
getRandomBytes
))
import
Data.Bifunctor
(
Bifunctor
(
bimap
))
...
...
@@ -18,10 +19,9 @@ import Tahoe.SDMF.Internal.Capability (Reader (..), Writer (..), deriveReader)
import
qualified
Tahoe.SDMF.Internal.Keys
as
Keys
import
Tahoe.SDMF.Internal.Share
(
HashChain
(
HashChain
),
Share
(
..
))
--- XXX Not sure why I have to nail down AES128 here
randomIV
::
MonadRandom
m
=>
m
(
Maybe
(
IV
AES128
))
randomIV
::
forall
c
m
.
(
BlockCipher
c
,
MonadRandom
m
)
=>
m
(
Maybe
(
IV
c
))
-- XXX Secure enough random source?
randomIV
=
(
makeIV
::
B
.
ByteString
->
Maybe
(
IV
AES128
))
<$>
getRandomBytes
(
blockSize
(
undefined
::
AES128
))
randomIV
=
(
makeIV
::
B
.
ByteString
->
Maybe
(
IV
c
))
<$>
getRandomBytes
(
blockSize
(
undefined
::
c
))
{- | Given a pre-determined key pair and sequence number, encode some
ciphertext into a collection of SDMF shares.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment