Products » dgEncrypt User Guide

Method:  Key::GenerateKey

GenerateKey(Length)

The GenerateKey method assigns a cryptographically viable random value to the key. This value is generated by using a version of the cipher itself as a Pseudorandom Number Generator, or PRNG.
 
Length
The Length argument is the length of the new key, in bytes. Note that legal key values for the Rijndael cipher must be 16, 24, or 32 bytes in length.
 
Example:
Dim strValue As String
Dim objKey As DGENCRYPTLib.Key

Set objKey = New DGENCRYPTLib.Key

objKey.GenerateKey 16
strValue = objKey.HexKey
MsgBox strValue

Set objKey = Nothing

 
Output:
F51B981E8DA091A6B96811C272FDD575