CSharpTest.Net
Decrypt(String) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > IEncryptDecrypt Interface > Decrypt Method : Decrypt(String) Method

text

Glossary Item Box

Decrypts a string from base-64 encoded text

Syntax

Visual Basic (Declaration) 
Overloads Function Decrypt( _
   ByVal text As String _
) As String
C# 
string Decrypt( 
   string text
)

Parameters

text

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