github.com/trustbloc/kms-go@v1.1.2/secretlock/local/internal/cipher/util.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 SPDX-License-Identifier: Apache-2.0 4 */ 5 6 package cipher 7 8 import ( 9 "crypto/aes" 10 "crypto/cipher" 11 ) 12 13 // package cipher provides utility functions to support the secretlock. 14 15 // CreateAESCipher will create a new AES cipher for the given key. 16 // This function is to be used by secretlock/local package only. 17 func CreateAESCipher(masterKey []byte) (cipher.AEAD, error) { 18 cipherBlock, err := aes.NewCipher(masterKey) 19 if err != nil { 20 return nil, err 21 } 22 23 return cipher.NewGCM(cipherBlock) 24 }