return decrypt error

This commit is contained in:
Jakub 2019-03-07 14:08:17 +01:00
parent 79a677eb2c
commit 8f4bbfc780
3 changed files with 11 additions and 11 deletions

View file

@ -7,8 +7,8 @@ import (
"golang.org/x/crypto/scrypt"
)
// Use: ios/android only
// EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption mode is not secure when stored/sent on an untrusted medium.
// Use: ios/android only
func EncryptWithoutIntegrity(key, input, iv []byte) (output []byte, err error) {
var block cipher.Block
if block, err = aes.NewCipher(key); err != nil {
@ -20,15 +20,15 @@ func EncryptWithoutIntegrity(key, input, iv []byte) (output []byte, err error) {
return
}
// Use: ios/android only
// DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
// Use: ios/android only
func DecryptWithoutIntegrity(key, input, iv []byte) ([]byte, error) {
// AES-CTR decryption is identical to encryption.
return EncryptWithoutIntegrity(key, input, iv)
}
// Use: ios/android only
// DeriveKey derives a key from a password using scrypt. N should be set to the highest power of 2 you can derive within 100 milliseconds.
// Use: ios/android only
func DeriveKey(password string, salt []byte, N int) ([]byte, error) {
return scrypt.Key([]byte(password), salt, N, 8, 1, 32)
}