diff --git a/aes/decryptor.go b/aes/decryptor.go index d303e663c..75ccfe342 100644 --- a/aes/decryptor.go +++ b/aes/decryptor.go @@ -18,9 +18,10 @@ type EncryptedValue struct { datatype string } +var encre = regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`) + func parse(value string) (*EncryptedValue, error) { - re := regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`) - matches := re.FindStringSubmatch(value) + matches := encre.FindStringSubmatch(value) if matches == nil { return nil, fmt.Errorf("Input string %s does not match sops' data format", value) }