Home Forums ActiveX components Xceed Encryption for ActiveX How do I set my encryption key using the SetSecretKeyFromPassPhrase method?

Viewing 1 post (of 1 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #43019 |

    The pass phrase you pass to the SetSecretKeyFromPassPhrase method will be hashed and the hash result will be returned to you via the SecretKey property. This resulting hash value will be the key your data is encrypted with and it will be of the length you specified in the nKeySize parameter of the SetSecretKeyFromPassPhrase method.

    For example, let’s say you have a pass phrase of 30 characters and a desired key length of 256 bits. Once hashed, your resulting key will be of 256 bits or 32 characters. If your key size was of 512, then your resulting secret key would be 64 characters in length.

    You need to also take the hash size into consideration. Basically, what this means is that if you have a hash size of 160 bits (the default for the SHA Hashing Method) then your key will be hashed to 160 bits plus the resulting 160 bit hash will be hashed until the desired key length is matched. This said, it is preferable that the HashSize property of the HashingMethod object (either Haval or SHA) be equal to or greater than the desired key size.

    Imported from legacy forums. Posted by Xceed admin (had 1668 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.