Network Security with OpenSSL by Chandra Pravir Messier Matt Viega John & Matt Messier & Pravir Chandra

Network Security with OpenSSL by Chandra Pravir Messier Matt Viega John & Matt Messier & Pravir Chandra

Author:Chandra, Pravir, Messier, Matt, Viega, John & Matt Messier & Pravir Chandra [John Viega]
Language: eng
Format: epub
Tags: COMPUTERS / Security / General
ISBN: 9780596551971
Publisher: O'Reilly Media
Published: 2009-02-08T16:00:00+00:00


type

The operation to perform, which can be one of the following constants:

EVP_CTRL_GET_RC2_KEY_BITS

EVP_CTRL_SET_RC2_KEY_BITS

EVP_CTRL_GET_RC5_ROUNDS

EVP_CTRL_SET_RC5_ROUNDS

arg

The numerical value to set, if appropriate. If not appropriate, its value is ignored.

ptr

A pointer to an integer for querying the numerical value of a property.

For example, to query the effective key bits in an RC2 cipher context, storing the result in a variable called kb:

EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &kb);

And to set the effective key strength of RC2 to 64 bits:

EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_SET_RC2_KEY_BITS, 64, NULL);

Setting and querying RC5 rounds works the same way. Remember from our previous discussion that OpenSSL is limited to 8, 12, or 16 rounds for RC5.

Another desirable option to set in a cipher context is whether padding is used. Without padding, the size of the ciphertext will always be the same size as the plaintext. On the downside, the length of the data encrypted must be an exact multiple of the block size. With padding, any length in bytes is feasible, but the resulting ciphertext can be up to a block longer than the plaintext. Unfortunately, OpenSSL versions through 0.9.6c do not allow padding to be disabled. This changes in Version 0.9.7, which has a function called EVP_CIPHER_CTX_set_padding that takes a pointer to a cipher context, and an integer that represents a Boolean value (0 for no padding, 1 for padding).



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.