/// <summary> ///Gets or sets the test context which provides ///information about and functionality for the current test run. ///</summary> //public TestContext TestContext { get; set; } public override IHasherTasks GetHasher() { using (var cipher = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), _keyFileName, hashAlgorithmName: null)) { return(cipher.CloneLightHasher() as IHasherTasks); } }
/// <summary> ///Gets or sets the test context which provides ///information about and functionality for the current test run. ///</summary> //public TestContext TestContext { get; set; } public override IHasherAsync GetHasher() { using (var cipher = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), null, keyFileName)) { return(cipher.CloneLightHasher() as IHasherAsync); } }
protected virtual EncryptedKeyCipher GetCipher(bool base64 = false) { using (var cipher = new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), _keyFileName)) { cipher.Base64Encoded = base64; return(cipher.CloneLightCipher() as EncryptedKeyCipher); } }
public override ICipherTasks GetCipher(bool base64 = false) { #pragma warning disable CS0618 // Type or member is obsolete var cipher = new EncryptedNewKeyHashedCipher(CertificateFactory.GetDecryptingCertificate(), Algorithms.Hash.MD5, Algorithms.Symmetric.Aes); #pragma warning restore CS0618 // Type or member is obsolete // ignore the parameter base64 return(cipher); }
public void GetDuplicateWithShouldEncryptIVTest() { var cipher = new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), _keyFileName) { ShouldEncryptIV = true, }; cipher.CloneLightCipher(); }
protected override EncryptedKeyCipher GetCipher(bool base64 = false) { var cipher = new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), _keyFileName) { Base64Encoded = base64, }; cipher.ReleaseCertificate(); return(cipher); }
public void StrippedCanVerifyItsOwn() { const string expected = "The quick fox jumps over the lazy dog."; using (var stripped = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), null, keyFileName).ReleaseCertificate()) { var hash = stripped.Hash(expected); Assert.IsTrue(stripped.TryVerifyHash(expected, hash)); } }
public void CloneCanVerifyItsOwn() { const string expected = "The quick fox jumps over the lazy dog."; using (var hasher = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), _keyFileName, hashAlgorithmName: null)) using (var clone = hasher.CloneLightHasher()) { var hash = clone.Hash(expected); Assert.IsTrue(clone.TryVerifyHash(expected, hash)); } }
public void OriginalCanVerifyStripped() { const string expected = "The quick fox jumps over the lazy dog."; using (var stripped = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), _keyFileName, hashAlgorithmName: null).ReleaseCertificate()) using (var original = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), _keyFileName, hashAlgorithmName: null)) { var hash = stripped.Hash(expected); Assert.IsTrue(original.TryVerifyHash(expected, hash)); } }
public void OriginalCanVerifyClone() { const string expected = "The quick fox jumps over the lazy dog."; using (var hasher = new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), null, keyFileName)) using (var clone = hasher.CloneLightHasher()) { var hash = clone.Hash(expected); Assert.IsTrue(hasher.TryVerifyHash(expected, hash)); } }
public override void DuplicateCanDecryptFromOriginal() { const string expected = "The quick fox jumps over the lazy dog."; using (var cipher = new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), _keyFileName)) { cipher.ExportSymmetricKey(); var encrypted = cipher.Encrypt(expected); cipher.ReleaseCertificate(); var decrypted = cipher.Decrypt <string>(encrypted); Assert.AreEqual(expected, decrypted); } }
public virtual void OriginalCanDecryptFromDuplicate() { const string expected = "The quick fox jumps over the lazy dog."; using (var cipher = new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), expected)) { cipher.ExportSymmetricKey(); using (var dupe = cipher.CloneLightCipher()) { var encrypted = dupe.Encrypt(expected); var decrypted = cipher.Decrypt <string>(encrypted); Assert.AreEqual(expected, decrypted); } } }
public InheritedHasher() : base(CertificateFactory.GetDecryptingCertificate()) { }
static IHasherAsync GetHasherImpl() => new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), null, "encryptedHashKey.key");
public InheritedEncryptedNewKeyCipher() : base(CertificateFactory.GetDecryptingCertificate(), null) { }
public override ICipherAsync GetCipher(bool base64 = false) => new EncryptedNewKeyCipher(CertificateFactory.GetDecryptingCertificate()) { Base64Encoded = base64, };
public override IHasherAsync GetHasher() => new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), null, keyFileName).ReleaseCertificate();
public override ICipherAsync GetCipher(bool base64 = false) => new EncryptedKeyCipher(CertificateFactory.GetDecryptingCertificate(), null, _keyFileName) { Base64Encoded = base64, };
public void GetCipherNullSignCertTest() { new EncryptedNewKeySignedCipher(CertificateFactory.GetDecryptingCertificate(), null); // default SHA1, SHA256 doesn't work here }
public override IHasherTasks GetHasher() => new KeyedHasher(CertificateFactory.GetDecryptingCertificate(), _keyFileName, hashAlgorithmName: null).ReleaseCertificate();
public InheritedEncryptedKeyCipher() : base(CertificateFactory.GetDecryptingCertificate(), Algorithms.Symmetric.Default, null) { }