public void PublicCertificateTest() { var input = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; var target = GetCipher(); var encrypted = target.Encrypt(input); target = new EncryptedKeyCipher(CertificateFactory.GetEncryptingCertificate(), null, _keyFileName); var output = target.Decrypt(encrypted); }
public static void ClassCleanup() { var keyManagement = new EncryptedKeyCipher(CertificateFactory.GetEncryptingCertificate(), null, _keyFileName) as IKeyManagement; if (keyManagement.KeyLocation.EndsWith(_keyFileName, StringComparison.InvariantCultureIgnoreCase) && File.Exists(keyManagement.KeyLocation)) { File.Delete(keyManagement.KeyLocation); } }
public static void ClassCleanup() { const string expected = "The quick fox jumps over the lazy dog."; var keyManagement = new EncryptedKeyCipher(CertificateFactory.GetEncryptingCertificate(), null, expected) as IKeyManagement; if (keyManagement.KeyLocation.EndsWith(expected, StringComparison.InvariantCultureIgnoreCase) && File.Exists(keyManagement.KeyLocation)) { File.Delete(keyManagement.KeyLocation); } }
public override ICipherAsync GetPublicCertCipher(bool base64 = false) => new EncryptedNewKeyCipher(CertificateFactory.GetEncryptingCertificate()) { Base64Encoded = base64, };
public override ICipherAsync GetPublicCertCipher(bool base64 = false) => new EncryptedKeyCipher(CertificateFactory.GetEncryptingCertificate(), null, _keyFileName) { Base64Encoded = base64, };
public InheritedEncryptedKeyCipher() : base(null, CertificateFactory.GetEncryptingCertificate()) { }
public InheritedEncryptedNewKeySignedCipher() : base(CertificateFactory.GetEncryptingCertificate(), CertificateFactory.GetSigningCertificate(), null) { }
CertificateFactory.GetSigningCertificate()); // SHA1 also works with this cert static ICipherAsync GetPublicCertCipherImpl() => new EncryptedNewKeySignedCipher( CertificateFactory.GetEncryptingCertificate(), CertificateFactory.GetSigningCertificate()); // default SHA1, SHA256 doesn't work here
public InheritedEncryptedKeyCipher() : base(CertificateFactory.GetEncryptingCertificate(), Algorithms.Symmetric.Default, null) { }
#pragma warning disable CS0618 // Type or member is obsolete public override ICipherTasks GetPublicCertCipher(bool base64 = false) => new EncryptedNewKeyHashedCipher(CertificateFactory.GetEncryptingCertificate(), Algorithms.Hash.MD5, Algorithms.Symmetric.Aes);