mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix: Local ETag computation
This commit is contained in:
@@ -3,6 +3,8 @@ package crypto
|
|||||||
import (
|
import (
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
|
"fmt"
|
||||||
|
"hash/crc32"
|
||||||
|
|
||||||
"golang.org/x/crypto/nacl/box"
|
"golang.org/x/crypto/nacl/box"
|
||||||
)
|
)
|
||||||
@@ -33,3 +35,8 @@ func DecryptAsymmetric(ciphertext []byte, nonce []byte, publicKey []byte, privat
|
|||||||
plainTextToReturn, _ := box.Open(nil, ciphertext, (*[24]byte)(nonce), (*[32]byte)(publicKey), (*[32]byte)(privateKey))
|
plainTextToReturn, _ := box.Open(nil, ciphertext, (*[24]byte)(nonce), (*[32]byte)(publicKey), (*[32]byte)(privateKey))
|
||||||
return plainTextToReturn
|
return plainTextToReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ComputeEtag(data []byte) string {
|
||||||
|
crc := crc32.ChecksumIEEE(data)
|
||||||
|
return fmt.Sprintf(`W/"secrets-%d-%08X"`, len(data), crc)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user