add decrypt function
This commit is contained in:
parent
c0b19e9395
commit
969a142382
1 changed files with 5 additions and 0 deletions
|
@ -71,6 +71,11 @@ func NewBlob(data, key, iv []byte) (Blob, error) {
|
||||||
return ciphertext, nil
|
return ciphertext, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DecryptBlob decrypts a blob
|
||||||
|
func DecryptBlob(b Blob, key, iv []byte) ([]byte, error) {
|
||||||
|
return b.Plaintext(key, iv)
|
||||||
|
}
|
||||||
|
|
||||||
func (b Blob) Plaintext(key, iv []byte) ([]byte, error) {
|
func (b Blob) Plaintext(key, iv []byte) ([]byte, error) {
|
||||||
blockCipher, err := aes.NewCipher(key)
|
blockCipher, err := aes.NewCipher(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue