MCPcopy
hub / github.com/kopia/kopia / Decrypt

Function Decrypt

internal/blobcrypto/blob_crypto.go:69–83  ·  view source on GitHub ↗

Decrypt decrypts the provided data using provided blobID to derive initialization vector.

(c Crypter, payload gather.Bytes, blobID blob.ID, output *gather.WriteBuffer)

Source from the content-addressed store, hash-verified

67
68// Decrypt decrypts the provided data using provided blobID to derive initialization vector.
69func Decrypt(c Crypter, payload gather.Bytes, blobID blob.ID, output *gather.WriteBuffer) error {
70 iv, err := getIndexBlobIV(blobID)
71 if err != nil {
72 return errors.Wrap(err, "unable to get index blob IV")
73 }
74
75 output.Reset()
76
77 // Decrypt will verify the payload.
78 if err := c.Encryptor().Decrypt(payload, iv, output); err != nil {
79 return errors.Wrapf(err, "error decrypting BLOB %v", blobID)
80 }
81
82 return nil
83}

Callers 6

maybeDecryptBlobMethod · 0.92
runMethod · 0.92
ParseIndexBlobFunction · 0.92
ListActiveSessionsMethod · 0.92
GetEncryptedBlobMethod · 0.92
TestBlobCryptoFunction · 0.85

Calls 4

getIndexBlobIVFunction · 0.85
ResetMethod · 0.65
DecryptMethod · 0.65
EncryptorMethod · 0.65

Tested by 1

TestBlobCryptoFunction · 0.68