diff --git a/AwsEncryptionSDK/runtimes/go/examples/main.go b/AwsEncryptionSDK/runtimes/go/examples/main.go index b58ec215b..2ced64bed 100644 --- a/AwsEncryptionSDK/runtimes/go/examples/main.go +++ b/AwsEncryptionSDK/runtimes/go/examples/main.go @@ -165,4 +165,7 @@ func main() { utils.GenerateUUIDTestData(numOfString), utils.DefaultKMSKeyId(), utils.DefaultKmsKeyRegion()) + + // cleanup + utils.CleanUpFiles() } diff --git a/AwsEncryptionSDK/runtimes/go/examples/utils/exampleUtils.go b/AwsEncryptionSDK/runtimes/go/examples/utils/exampleUtils.go index 0c02b1148..7eb685f33 100644 --- a/AwsEncryptionSDK/runtimes/go/examples/utils/exampleUtils.go +++ b/AwsEncryptionSDK/runtimes/go/examples/utils/exampleUtils.go @@ -53,6 +53,14 @@ twIDAQAB testKmsEcdhKeyIdP256RecipientKeyId = "arn:aws:kms:us-west-2:370957321024:key/0265c8e9-5b6a-4055-8f70-63719e09fda5" ) +var filesCreatedByExamples = []string{ + eccPrivateKeyFileNameSender, + eccPrivateKeyFileNameRecipient, + eccPublicKeyFileNameRecipient, + kmsEccPublicKeyFileNameRecipient, + kmsEccPublicKeyFileNameSender, +} + // Getter functions func KmsEcdhKeyIdP256SenderKeyId() string { @@ -157,6 +165,12 @@ func KeyStoreName() string { // Utility functions +func CleanUpFiles() { + for _, file := range filesCreatedByExamples { + os.Remove(file) + } +} + func WriteRawEcdhEccKeys(ecdhCurveSpec awscryptographyprimitivessmithygeneratedtypes.ECDHCurveSpec) error { // Safety check: Validate neither file is present if FileExists(eccPrivateKeyFileNameSender) ||