-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1757860 Fips compliant GCM encryption
- Loading branch information
1 parent
05da00a
commit a346138
Showing
16 changed files
with
740 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#if NETSTANDARD2_1 | ||
using System.IO; | ||
using Snowflake.Data.Core; | ||
using Snowflake.Data.Core.FileTransfer; | ||
|
||
namespace Snowflake.Data.Tests.Util | ||
{ | ||
internal class AesGcmDecryption : IDecryptionProvider | ||
{ | ||
public static readonly AesGcmDecryption Instance = new AesGcmDecryption(); | ||
|
||
public Stream DecryptFile( | ||
string inFile, | ||
PutGetEncryptionMaterial encryptionMaterial, | ||
SFEncryptionMetadata encryptionMetadata) | ||
{ | ||
return AesGcmEncryptionProvider.DecryptFile( | ||
inFile, | ||
encryptionMaterial, | ||
encryptionMetadata); | ||
} | ||
|
||
public Stream Decrypt( | ||
byte[] inputBytes, | ||
PutGetEncryptionMaterial encryptionMaterial, | ||
SFEncryptionMetadata encryptionMetadata) | ||
{ | ||
return AesGcmEncryptionProvider.Decrypt( | ||
inputBytes, | ||
encryptionMaterial, | ||
encryptionMetadata); | ||
} | ||
|
||
public string ExpectedExceptionMessage() => "The computed authentication tag did not match the input authentication tag."; | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#if NETSTANDARD2_1 | ||
using System.IO; | ||
using Snowflake.Data.Core; | ||
using Snowflake.Data.Core.FileTransfer; | ||
|
||
namespace Snowflake.Data.Tests.Util | ||
{ | ||
internal class AesGcmEncryption : IEncryptionProvider | ||
{ | ||
public static readonly AesGcmEncryption Instance = new AesGcmEncryption(); | ||
|
||
public Stream EncryptFile( | ||
string inFile, | ||
PutGetEncryptionMaterial encryptionMaterial, | ||
SFEncryptionMetadata encryptionMetadata, | ||
byte[] contentAad, | ||
byte[] keyAad | ||
) | ||
{ | ||
return AesGcmEncryptionProvider.EncryptFile( | ||
inFile, | ||
encryptionMaterial, | ||
encryptionMetadata, | ||
contentAad, | ||
keyAad); | ||
} | ||
|
||
public Stream Encrypt( | ||
PutGetEncryptionMaterial encryptionMaterial, | ||
SFEncryptionMetadata encryptionMetadata, | ||
byte[] inputBytes, | ||
byte[] contentAad, | ||
byte[] keyAad) | ||
{ | ||
return AesGcmEncryptionProvider.Encrypt( | ||
encryptionMaterial, | ||
encryptionMetadata, | ||
inputBytes, | ||
contentAad, | ||
keyAad); | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.