func EncryptAesGcmFull(data, key, nonce []byte) ([]byte, error) {
	c, err := aes.NewCipher(key)
	if err != nil {
		return nil, err
	}

	gcm, err := cipher.NewGCM(c)
	if err != nil {
		return nil, err
	}

	if len(nonce) == 0 {
		nonce, err = GetRandomBytes(AesGcmNonceSize)
		if err != nil {
			return nil, err
		}
	}
	if len(nonce) != AesGcmNonceSize {
		return nil, errors.New("incorrect nonce size")
	}

	result := gcm.Seal(nonce, nonce, data, nil)
	return result, nil
}
// Encrypt a message using AES-GCM with custom nonce.
Encrypt a message using AES-GCM with custom nonce.
// Encrypt a message using AES - GCM with custom nonce .
func EncryptAesGcmFull(data, key, nonce []byte) ([]byte, error) {
	c, err := aes.NewCipher(key)
	if err != nil {
		return nil, err
	}
	gcm, err := cipher.NewGCM(c)
	if err != nil {
		return nil, err
	}
	if len(nonce) == 0 {
		nonce, err = GetRandomBytes(AesGcmNonceSize)
		if err != nil {
			return nil, err
		}
	}
	if len(nonce) != AesGcmNonceSize {
		return nil, errors.New("incorrect nonce size")
	}
	result := gcm.Seal(nonce, nonce, data, nil)
	return result, nil
}
func EncryptAesGcmFull ( data , key , nonce [ ] byte ) ( [ ] byte , error ) { c , err := aes . NewCipher ( key ) if err != nil { return nil , err } gcm , err := cipher . NewGCM ( c ) if err != nil { return nil , err } if len ( nonce ) == 0 { nonce , err = GetRandomBytes ( AesGcmNonceSize ) if err != nil { return nil , err } } if len ( nonce ) != AesGcmNonceSize { return nil , errors . New ( " " ) } result := gcm . Seal ( nonce , nonce , data , nil ) return result , nil }
Encrypt a message using AES-GCM with custom nonce.
Encrypt a message using AES - GCM with custom nonce .