Skip to content
Snippets Groups Projects
Commit 77e27cab authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

replace the last fromIntegral from Share.hs

parent 740b0f73
No related branches found
No related tags found
1 merge request!7Implement enough encryption and encoding to be able to read plaintext from Tahoe-LAFS-generated SDMF shares
Checking pipeline status
......@@ -13,6 +13,7 @@ import Data.Binary.Put (putByteString, putLazyByteString, putWord16be, putWord32
import qualified Data.ByteArray as ByteArray
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
import Data.Int (Int64)
import Data.Word (Word16, Word32, Word64, Word8)
import Data.X509 (PrivKey (PrivKeyRSA), PubKey (PubKeyRSA))
import Tahoe.CHK.Merkle (MerkleTree, leafHashes)
......@@ -183,7 +184,10 @@ instance Binary Share where
shareSignature <- getByteString (from $ hashChainOffset - signatureOffset)
shareHashChain <- isolate (from $ blockHashTreeOffset - hashChainOffset) get
shareBlockHashTree <- isolate (from $ shareDataOffset - blockHashTreeOffset) get
shareData <- getLazyByteString (fromIntegral encryptedPrivateKeyOffset - fromIntegral shareDataOffset)
blockLength <- tryInto @Int64 "Binary.get Share could not represent share block length" (encryptedPrivateKeyOffset - into @Word64 shareDataOffset)
shareData <- getLazyByteString blockLength
keyBytesLength <- tryInto @Int "Binary.get Share cannot represent private key length" (eofOffset - encryptedPrivateKeyOffset)
shareEncryptedPrivateKey <- getByteString keyBytesLength
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment