public FieldLevelEncryption(byte[] rawPublicKeyData, byte[] rawPrivateKeyData, Config config, String publicKeyFingerprint, X509KeyStorageFlags keyStorageFlags = X509KeyStorageFlags.DefaultKeySet) { if (rawPublicKeyData != null && rawPublicKeyData.LongLength > 0L) { var tmpPublicCertificate = new X509Certificate2(rawPublicKeyData, String.Empty, keyStorageFlags); this.publicKey = (RSACng)tmpPublicCertificate.GetRSAPublicKey(); if (publicKeyFingerprint != null) { this.publicKeyFingerPrint = publicKeyFingerprint; } else { this.publicKeyFingerPrint = tmpPublicCertificate.Thumbprint; } } if (rawPrivateKeyData != null) { string fullText = Encoding.UTF8.GetString(rawPrivateKeyData); this.privateKey = CryptUtil.GetRSAFromPrivateKeyString(fullText); } this.configuration = config; }
public FieldLevelEncryption(String publicKeyLocation, String privateKeyLocation, Config config, String publicKeyFingerprint, X509KeyStorageFlags keyStorageFlags = X509KeyStorageFlags.DefaultKeySet) { if (publicKeyLocation != null) { var tmpPublicCertificate = new X509Certificate2(publicKeyLocation, String.Empty, keyStorageFlags); this.publicKey = (RSACng)tmpPublicCertificate.GetRSAPublicKey(); if (publicKeyFingerprint != null) { this.publicKeyFingerPrint = publicKeyFingerprint; } else { this.publicKeyFingerPrint = tmpPublicCertificate.Thumbprint; } } if (privateKeyLocation != null) { string fullText = File.ReadAllText(privateKeyLocation); this.privateKey = CryptUtil.GetRSAFromPrivateKeyString(fullText); } this.configuration = config; }
public MDESCryptography(string publicKeyLocation, string privateKeyLocation) { X509Certificate2 x509Certificate = new X509Certificate2(publicKeyLocation); this.publicKey = x509Certificate.GetRSAPublicKey(); this.publicKeyFingerPrint = x509Certificate.Thumbprint; string text = File.ReadAllText(privateKeyLocation); this.privateKey = CryptUtil.GetRSAFromPrivateKeyString(text); }
public MDESCryptography(String publicKeyLocation, String privateKeyLocation) { var tmpPublicCertificate = new X509Certificate2(publicKeyLocation); this.publicKey = tmpPublicCertificate.GetRSAPublicKey(); this.publicKeyFingerPrint = tmpPublicCertificate.Thumbprint; string fullText = File.ReadAllText(privateKeyLocation); this.privateKey = CryptUtil.GetRSAFromPrivateKeyString(fullText) as RSA; }