{"record":{"id":"822a9145b497bfb6","repo":"getsops/sops","slug":"error-base64-decoding-encrypted-data-key-s","errorCode":null,"errorMessage":"error base64-decoding encrypted data key: %s","messagePattern":"error base64-decoding encrypted data key: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kms/keysource.go","lineNumber":323,"sourceCode":"func (key *MasterKey) SetEncryptedDataKey(enc []byte) {\n\tkey.EncryptedKey = string(enc)\n}\n\n// Decrypt decrypts the EncryptedKey with a newly created AWS KMS config, and\n// returns the result.\n//\n// Consider using DecryptContext instead.\nfunc (key *MasterKey) Decrypt() ([]byte, error) {\n\treturn key.DecryptContext(context.Background())\n}\n\n// DecryptContext decrypts the EncryptedKey with a newly created AWS KMS config, and\n// returns the result.\nfunc (key *MasterKey) DecryptContext(ctx context.Context) ([]byte, error) {\n\tk, err := base64.StdEncoding.DecodeString(key.EncryptedKey)\n\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, fmt.Errorf(\"error base64-decoding encrypted data key: %s\", err)\n\t}\n\tcfg, err := key.createKMSConfig(ctx)\n\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, err\n\t}\n\tclient := key.createClient(cfg)\n\tinput := &kms.DecryptInput{\n\t\tKeyId:             &key.Arn,\n\t\tCiphertextBlob:    k,\n\t\tEncryptionContext: stringPointerToStringMap(key.EncryptionContext),\n\t}\n\tdecrypted, err := client.Decrypt(ctx, input)\n\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, fmt.Errorf(\"failed to decrypt sops data key with AWS KMS: %w\", err)\n\t}\n\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption succeeded\")","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/kms/keysource.go#L305-L341","documentation":"Error \"error base64-decoding encrypted data key: %s\" thrown in getsops/sops.","triggerScenarios":"Thrown at kms/keysource.go:323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13442bb98183887d7a9ac09ec8ab0564673a59d8","analyzedAt":"2026-09-01T03:53:00.447Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}