CryptoSys API Library Manual

Example: Pc1.Encrypt 

[VB6 equivalent: PC1_Bytes]

Dim abKey() As Byte
Dim abInput() As Byte
Dim abOutput() As Byte
Dim sCorrect As String

abKey = Cnv.FromHex("0123456789abcdef")
abInput = Cnv.FromHex("0123456789abcdef")
sCorrect = "75b7878099e0c596"

Console.WriteLine("KY=" & " " & Cnv.ToHex(abKey))
Console.WriteLine("PT=" & " " & Cnv.ToHex(abInput))
' Encipher using PC1
abOutput = Pc1.Encrypt(abInput, abKey)
Console.WriteLine("CT=" & " " & Cnv.ToHex(abOutput))
Console.WriteLine("OK=" & " " & sCorrect)

' Now decipher just by calling again. Use same output as input.
abOutput = Pc1.Encrypt(abOutput, abKey)
Console.WriteLine("P'=" & " " & Cnv.ToHex(abOutput))

See Also:
Pc1.Encrypt Method (Byte[], Byte[])

[Contents] [Index]

[PREV: Example: Pbe.Kdf2 ...]   [Contents]   [Index]   
   [NEXT: Example: Pc1.File ...]

Copyright © 2001-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-05-20T13:01:10Z.