Class CryptoFactory
- Namespace
- ParquetSharp.Encryption
- Assembly
- ParquetSharp.dll
Translates high-level encryption configuration into low-level encryption parameters
public sealed class CryptoFactory : IDisposable
- Inheritance
-
CryptoFactory
- Implements
- Inherited Members
Constructors
CryptoFactory(KmsClientFactory)
Create a new CryptoFactory
public CryptoFactory(CryptoFactory.KmsClientFactory kmsClientFactory)
Parameters
kmsClientFactoryCryptoFactory.KmsClientFactoryCreates KMS clients from a connection configuration
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetFileDecryptionProperties(KmsConnectionConfig, DecryptionConfiguration, string?)
Get decryption properties for a Parquet file. If external key material is used then the path to the parquet file must be provided. This CryptoFactory instance must remain alive and not disposed until after any files using these decryption properties have been read, as internally the FileDecryptionProperties contains references to data in the CryptoFactory that cannot be managed by ParquetSharp. Failure to do so may result in native memory access violations and crashes that cannot be caught as exceptions.
public FileDecryptionProperties GetFileDecryptionProperties(KmsConnectionConfig connectionConfig, DecryptionConfiguration decryptionConfig, string? filePath = null)
Parameters
connectionConfigKmsConnectionConfigThe KMS connection configuration to use
decryptionConfigDecryptionConfigurationThe decryption configuration to use
filePathstringThe path to the Parquet file being read. Can be null if internal key material is used.
Returns
- FileDecryptionProperties
Decryption properties for the file
GetFileEncryptionProperties(KmsConnectionConfig, EncryptionConfiguration, string?)
Get the encryption properties for a Parquet file. If external key material is used then the path to the Parquet file must be provided.
public FileEncryptionProperties GetFileEncryptionProperties(KmsConnectionConfig connectionConfig, EncryptionConfiguration encryptionConfig, string? filePath = null)
Parameters
connectionConfigKmsConnectionConfigThe KMS connection configuration to use
encryptionConfigEncryptionConfigurationThe encryption configuration to use
filePathstringThe path to the Parquet file being written. Can be null if internal key material is used.
Returns
- FileEncryptionProperties
Encryption properties for the file
RotateMasterKeys(KmsConnectionConfig, string, bool, double)
Rotates master encryption keys for a Parquet file that uses external key material. In single wrapping mode, data encryption keys are decrypted with the old master keys and then re-encrypted with new master keys. In double wrapping mode, key encryption keys are decrypted with the old master keys and then re-encrypted with new master keys. This relies on the KMS supporting versioning, such that the old master key is used when unwrapping a key, and the latest version is used when wrapping a key.
public void RotateMasterKeys(KmsConnectionConfig connectionConfig, string parquetFilePath, bool doubleWrapping, double cacheLifetimeSeconds = 600)
Parameters
connectionConfigKmsConnectionConfigThe KMS connection configuration to use
parquetFilePathstringPath to the encrypted Parquet file
doubleWrappingboolWhether to use double wrapping when rotating
cacheLifetimeSecondsdoubleLifetime of cached objects in seconds