CSharpTest.Net
Passthrough Field
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > Encryption Class : Passthrough Field

Glossary Item Box

Implements the encryption api but does not change any data

Syntax

Visual Basic (Declaration) 
Public Shared ReadOnly Passthrough As IEncryptDecrypt
C# 
public static readonly IEncryptDecrypt Passthrough

Example

Library/Library.Test/TestEncryption.cs

C#Copy Code
string value = TEST_PASSWORD;

Encryption.Passthrough.Dispose();//ignores

Assert.AreEqual(value, Encryption.Passthrough.Encrypt(value));
Assert.AreEqual(value, Encryption.Passthrough.Encrypt(value, ByteEncoding.Hex));
Assert.AreEqual(value, Encryption.Passthrough.Decrypt(value));
Assert.AreEqual(value, Encryption.Passthrough.Decrypt(value, ByteEncoding.Hex));

byte[] bytes = Password.Encoding.GetBytes(value);
Assert.AreEqual(bytes, Encryption.Passthrough.Encrypt(bytes));
Assert.AreEqual(bytes, Encryption.Passthrough.Decrypt(bytes));

Assert.AreEqual(bytes, IOStream.ReadAllBytes(Encryption.Passthrough.Encrypt(new MemoryStream(bytes))));
Assert.AreEqual(bytes, IOStream.ReadAllBytes(Encryption.Passthrough.Decrypt(new MemoryStream(bytes))));
VB.NETCopy Code
Dim value As String = TEST_PASSWORD

Encryption.Passthrough.Dispose()
'ignores
Assert.AreEqual(value, Encryption.Passthrough.Encrypt(value))
Assert.AreEqual(value, Encryption.Passthrough.Encrypt(value, ByteEncoding.Hex))
Assert.AreEqual(value, Encryption.Passthrough.Decrypt(value))
Assert.AreEqual(value, Encryption.Passthrough.Decrypt(value, ByteEncoding.Hex))

Dim bytes As Byte() = Password.Encoding.GetBytes(value)
Assert.AreEqual(bytes, Encryption.Passthrough.Encrypt(bytes))
Assert.AreEqual(bytes, Encryption.Passthrough.Decrypt(bytes))

Assert.AreEqual(bytes, IOStream.ReadAllBytes(Encryption.Passthrough.Encrypt(New MemoryStream(bytes))))
Assert.AreEqual(bytes, IOStream.ReadAllBytes(Encryption.Passthrough.Decrypt(New MemoryStream(bytes))))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys