Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

October 21, 2005

Binary Secret Keys

(regarding symmetric encryption, such as AES/Rijndael, Blowfish, Twofish…)

If we’re receiving a key from someone else, how do we set our secret key to be that. Until now we’ve just been using the crypt.GenerateSecretKey("***") method. But now we want to set the key to one sent by someone else. What for should we get them to send it in?

Encryption algorithms use *binary* secret keys. For a N-bit algorithm, the key is N bits. So… for 128-bit encryption, the binary secret key is 16 bytes (8 bits/byte * 16 = 128 bits). If you intend to use password strings, the string must be hashed to a binary byte array that is the correct length. The crypt.GenerateSecretKey method does this — it hashes a string and returns a binary secret key (byte array) of the correct length. If you need to interoperate with other systems, you should set the SecretKey property directly (the SecretKey property is a byte array representing the raw binary secret key). If you want to use password strings, you might use Chilkat Crypt’s hashing methods to hash your string to construct a key of the appropriate length.

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.