Re: 3DES and how to change mode and set IV.
Peter Gutmann <[email protected]>
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <[email protected]> |
Fernando Perez <[email protected]> writes: >I need to crypt/decrypt with cryptlib, but I need to support all mode formats >(cbc, ecb, ....) and IV's. I have read documentation, search into but I >have no luck to get info on how to change cbc-mode or set the IV. I need a >step by step functions to execute (an esquematic view)... To set the IV, see "Working with Initialisation Vectors" in the manual, or "Conventional Encryption" for a complete code example. Here's a sample, for CBC mode: CRYPT_CONTEXT cryptContext; cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); cryptEncrypt( cryptContext, data, length ); cryptDestroyContext( cryptContext ); Peter. _______________________________________________ Cryptlib mailing list [email protected] via Mail: [email protected] Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages.