Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] نسخه متنی

This is a Digital Library

With over 100,000 free electronic resource in Persian, Arabic and English

Building.Open.Source.Network.Security.Tools.Components.And.Techniques [Electronic resources] - نسخه متنی

Mike D. Schiffman

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Table 7.1 with which OpenSSL was compiled.



void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx);


EVP_ClPHER_CTX_init () initializes a symmetric cipher context ctx for use by filling it with zero. You must call this function prior to any other function that modifies ctx.



const EVP_CIPHER *EVP_get_cipherbyname(const char *name);


EVP_get_cipherbyname () returns a pointer to a cipher type corresponding to the canonical name of the algorithm name (such as "cast" for the CAST algorithm). Upon success, the function returns a pointer to the cipher structure; upon failure (name is not a supported algorithm), the function returns NULL.



int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER
*type, ENGINE *impl, unsigned char *key, unsigned char *iv,
int enc);


EVP_CipherInit_ex () initializes an encryption context ctx by using the cipher type from engine impl with the symmetric key key and initialization vector iv.ctx should be previously initialized by a call to EVP_CIPHER_CTX_init () while type should have been acquired from a previous call to EVP_getcipherbyname (). If impl is NULL, the default software implementation is used. If enc is positive and non-zero, the function sets up an encryption context; if enc is 0, the function sets up a decryption context. If enc is −1, the function leaves the context unchanged, assuming that it was set up in a previous call. While you can omit key and iv and specify them later in the encryption process, it is good form to specify them here at initialization. Upon success, the function returns 1; upon failure, the function returns 0.



int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl);


EVP_CipherUpdate () performs encryption or decryption for the context referenced by ctx. Depending on how ctx was initialized, the function either encrypts or decrypts inl bytes of data from in and writes them to out, storing the number of bytes written in outl. This function is generally called repeatedly in a loop on the input data block until the end is reached. If, at the end of the encryption or decryption process, data is left that is not a multiple of the block size, you should call EVP_CipherFinal_ex (). Upon success, the function returns 1; upon failure, the function returns 0.



int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char
*out, int *outl);


EVP_CipherFinal_ex() finalizes the encryption or decryption process for the context referenced by ctx. If padding is enabled for ctx (which it is by default), the function encrypts or decrypts the remaining bytes of data, padding to a multiple of the block size if necessary (using normal PCKS padding rules)-writing them to out and writing the number of bytes written to outl. If padding is disabled via a call to EVP_CIPHER_CTX_set_padding (), the function will not process any more data and will return an error if any data remains in a partial block (assuming the partial data is not a multiple of the block size). After you call the function, the encryption or decryption process is considered "finished" (you should not make any other calls to EVP_CipherUpdate ()). Upon success, the function returns 1; upon failure, the function returns 0.



int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx);


EVP_CIPHER_CTX_cleanup () destroys all structures and cleans up all memory including sensitive data) associated with ctx. This function is always called inside EVP_CipherFinal_ex () to implicitly cleanup upon finalizing. As such, the function only needs to be called in the event of an unrecoverable error being detected (for instance, EVP_CipherUpdate () failed) and the cipher operation needs to be terminated before EVP_CipherFinal_ex () can be called. Upon success, the function returns 1; upon failure, the function returns 0.



int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int
padding);


EVP_CIPHER_CTX_set_padding () enables block padding for ctx if the padding is 1 and disables block padding for ctx if padding is 0. The function always returns 1.



int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int
keylen);


EVP_CIPHER_CTX_set_key_length() sets the key length keylen for the algorithm that ctx references. If the algorithm utilizes a fixed-length key, setting the keylen to any value other than the fixed length will result in an error. Upon success, the function returns 1; upon failure, the function returns 0.



EVP_CIPHER_CTX_cipher(ctx);


EVP_CIPHER_CTX_cipher () is a macro that returns the EVP_CIPHER structure from ctx.



EVP_CIPHER_CTX_block_size(ctx) ;


EVP_ClPHER_CTX_blocksize is a macro that returns the block size from ctx.



EVP_CIPHER_CTX_key_length(ctx);


EVP_CIPHER_CTX_key-length is a macro that returns the key length from ctx.



EVP_CIPHER_CTX_iv_length(ctx);


EVP_CIPHER_CTX_iv_length is a macro that returns the initialization vector length from ctx.



EVP_CIPHER__CTX_get_app_data(ctx);


EVP_CIPHER_CTX_get_app_data is a macro that returns the application data field from ctx.



EVP_CIPHER_CTX_set_app_data(ctx, data);


EVP_CIPHER_CTX_set_app_data is a macro that sets the application data field (a void *) in ctx to data.



EVP_CIPHER_CTX_flags(ctx);


EVP_CIPHER_CTX_flags is a macro that returns the control flags set for ctx.



EVP_CIPHER_CTX_mode(ctx);


EVP_CIPHER_CTX_mode is a macro that returns the mode for ctx, which will be one of the following: EVP_CIPH_ECB_MODE, EVP_ CIPH_CBC_MODE, EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_STREAM_CIPHER.

/ 135