MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / decrypt

Function decrypt

driver/oss/singularity.go:39–55  ·  view source on GitHub ↗
(data []byte, key []byte)

Source from the content-addressed store, hash-verified

37}
38
39func decrypt(data []byte, key []byte) []byte {
40 block, err := aes.NewCipher(key)
41 if err != nil {
42 panic(err.Error())
43 }
44 gcm, err := cipher.NewGCM(block)
45 if err != nil {
46 panic(err.Error())
47 }
48 nonceSize := gcm.NonceSize()
49 nonce, cipherText := data[:nonceSize], data[nonceSize:]
50 plaintext, err := gcm.Open(nil, nonce, cipherText, nil)
51 if err != nil {
52 panic(err.Error())
53 }
54 return plaintext
55}

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45
OpenMethod · 0.45

Tested by

no test coverage detected