diff options
Diffstat (limited to 'secure/lib/libcrypto/man/EVP_EncryptInit.3')
-rw-r--r-- | secure/lib/libcrypto/man/EVP_EncryptInit.3 | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/secure/lib/libcrypto/man/EVP_EncryptInit.3 b/secure/lib/libcrypto/man/EVP_EncryptInit.3 index 11d53b3..1d96fee 100644 --- a/secure/lib/libcrypto/man/EVP_EncryptInit.3 +++ b/secure/lib/libcrypto/man/EVP_EncryptInit.3 @@ -1,8 +1,7 @@ -.\" Automatically generated by Pod::Man version 1.15 -.\" Wed Mar 17 09:38:35 2004 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: -.\" ====================================================================== +.\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp @@ -15,12 +14,6 @@ .if t .sp .5v .if n .sp .. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. .de Vb \" Begin verbatim text .ft CW .nf @@ -28,15 +21,14 @@ .. .de Ve \" End verbatim text .ft R - .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ @@ -56,10 +48,10 @@ . ds R" '' 'br\} .\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" @@ -68,14 +60,13 @@ . rr F .\} .\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 @@ -135,11 +126,10 @@ . ds Ae AE .\} .rm #[ #] #H #V #F C -.\" ====================================================================== +.\" ======================================================================== .\" .IX Title "EVP_EncryptInit 3" -.TH EVP_EncryptInit 3 "0.9.7d" "2004-03-17" "OpenSSL" -.UC +.TH EVP_EncryptInit 3 "2005-02-24" "0.9.7d" "OpenSSL" .SH "NAME" EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, @@ -155,15 +145,17 @@ EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, -EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines +EVP_CIPHER_CTX_set_padding \- EVP cipher routines .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/evp.h> .Ve +.PP .Vb 1 \& int EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); .Ve +.PP .Vb 6 \& int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv); @@ -172,6 +164,7 @@ EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines \& int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl); .Ve +.PP .Vb 6 \& int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv); @@ -180,6 +173,7 @@ EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines \& int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); .Ve +.PP .Vb 6 \& int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv, int enc); @@ -188,35 +182,41 @@ EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines \& int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); .Ve +.PP .Vb 4 \& int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv); \& int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl); .Ve +.PP .Vb 4 \& int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv); \& int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); .Ve +.PP .Vb 4 \& int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv, int enc); \& int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); .Ve +.PP .Vb 4 \& int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding); \& int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); \& int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); \& int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); .Ve +.PP .Vb 3 \& const EVP_CIPHER *EVP_get_cipherbyname(const char *name); \& #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) \& #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) .Ve +.PP .Vb 7 \& #define EVP_CIPHER_nid(e) ((e)->nid) \& #define EVP_CIPHER_block_size(e) ((e)->block_size) @@ -226,6 +226,7 @@ EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines \& #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) \& int EVP_CIPHER_type(const EVP_CIPHER *ctx); .Ve +.PP .Vb 10 \& #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) \& #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) @@ -238,6 +239,7 @@ EVP_CIPHER_CTX_set_padding \- \s-1EVP\s0 cipher routines \& #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) \& #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) .Ve +.PP .Vb 2 \& int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); \& int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); @@ -423,50 +425,50 @@ success or zero for failure. .SH "CIPHER LISTING" .IX Header "CIPHER LISTING" All algorithms have a fixed key length unless otherwise stated. -.Ip "\fIEVP_enc_null()\fR" 4 +.IP "\fIEVP_enc_null()\fR" 4 .IX Item "EVP_enc_null()" Null cipher: does nothing. -.Ip "EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void)" 4 +.IP "EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void)" 4 .IX Item "EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void)" \&\s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. -.Ip "EVP_des_ede_cbc(void), \fIEVP_des_ede()\fR, EVP_des_ede_ofb(void), EVP_des_ede_cfb(void)" 4 +.IP "EVP_des_ede_cbc(void), \fIEVP_des_ede()\fR, EVP_des_ede_ofb(void), EVP_des_ede_cfb(void)" 4 .IX Item "EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void)" Two key triple \s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. -.Ip "EVP_des_ede3_cbc(void), \fIEVP_des_ede3()\fR, EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void)" 4 +.IP "EVP_des_ede3_cbc(void), \fIEVP_des_ede3()\fR, EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void)" 4 .IX Item "EVP_des_ede3_cbc(void), EVP_des_ede3(), EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void)" Three key triple \s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. -.Ip "EVP_desx_cbc(void)" 4 +.IP "EVP_desx_cbc(void)" 4 .IX Item "EVP_desx_cbc(void)" \&\s-1DESX\s0 algorithm in \s-1CBC\s0 mode. -.Ip "EVP_rc4(void)" 4 +.IP "EVP_rc4(void)" 4 .IX Item "EVP_rc4(void)" \&\s-1RC4\s0 stream cipher. This is a variable key length cipher with default key length 128 bits. -.Ip "EVP_rc4_40(void)" 4 +.IP "EVP_rc4_40(void)" 4 .IX Item "EVP_rc4_40(void)" \&\s-1RC4\s0 stream cipher with 40 bit key length. This is obsolete and new code should use \fIEVP_rc4()\fR and the \fIEVP_CIPHER_CTX_set_key_length()\fR function. -.Ip "\fIEVP_idea_cbc()\fR EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void)" 4 +.IP "\fIEVP_idea_cbc()\fR EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void)" 4 .IX Item "EVP_idea_cbc() EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void)" \&\s-1IDEA\s0 encryption algorithm in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. -.Ip "EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void)" 4 +.IP "EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void)" 4 .IX Item "EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void)" \&\s-1RC2\s0 encryption algorithm in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. This is a variable key length cipher with an additional parameter called \*(L"effective key bits\*(R" or \*(L"effective key length\*(R". By default both are set to 128 bits. -.Ip "EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void)" 4 +.IP "EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void)" 4 .IX Item "EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void)" \&\s-1RC2\s0 algorithm in \s-1CBC\s0 mode with a default key length and effective key length of 40 and 64 bits. These are obsolete and new code should use \fIEVP_rc2_cbc()\fR, \fIEVP_CIPHER_CTX_set_key_length()\fR and \&\fIEVP_CIPHER_CTX_ctrl()\fR to set the key length and effective key length. -.Ip "EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void);" 4 +.IP "EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void);" 4 .IX Item "EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void);" Blowfish encryption algorithm in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. This is a variable key length cipher. -.Ip "EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void)" 4 +.IP "EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void)" 4 .IX Item "EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void)" \&\s-1CAST\s0 encryption algorithm in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. This is a variable key length cipher. -.Ip "EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void)" 4 +.IP "EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void)" 4 .IX Item "EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void)" \&\s-1RC5\s0 encryption algorithm in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. This is a variable key length cipher with an additional \*(L"number of rounds\*(R" parameter. By default the key length is set to 128 @@ -519,24 +521,28 @@ Get the number of rounds used in \s-1RC5:\s0 \& int nrounds; \& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &nrounds); .Ve +.PP Get the \s-1RC2\s0 effective key length: .PP .Vb 2 \& int key_bits; \& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &key_bits); .Ve +.PP Set the number of rounds used in \s-1RC5:\s0 .PP .Vb 2 \& int nrounds; \& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, nrounds, NULL); .Ve +.PP Set the effective key length used in \s-1RC2:\s0 .PP .Vb 2 \& int key_bits; \& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); .Ve +.PP Encrypt a string using blowfish: .PP .Vb 14 @@ -555,6 +561,7 @@ Encrypt a string using blowfish: \& EVP_CIPHER_CTX_init(&ctx); \& EVP_EncryptInit_ex(&ctx, EVP_bf_cbc(), NULL, key, iv); .Ve +.PP .Vb 25 \& if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) \& { @@ -582,12 +589,14 @@ Encrypt a string using blowfish: \& return 1; \& } .Ve +.PP The ciphertext from the above example can be decrypted using the \fBopenssl\fR utility with the command line: .PP .Vb 1 \& S<openssl bf -in cipher.bin -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 -d> .Ve +.PP General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC2\s0 with an 80 bit key: .PP @@ -609,6 +618,7 @@ General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC \& /* We finished modifying parameters so now we can set key and IV */ \& EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt); .Ve +.PP .Vb 17 \& for(;;) \& { @@ -628,6 +638,7 @@ General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC \& } \& fwrite(outbuf, 1, outlen, out); .Ve +.PP .Vb 3 \& EVP_CIPHER_CTX_cleanup(&ctx); \& return 1; @@ -635,7 +646,7 @@ General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" -evp(3) +\&\fIevp\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" \&\fIEVP_CIPHER_CTX_init()\fR, \fIEVP_EncryptInit_ex()\fR, \fIEVP_EncryptFinal_ex()\fR, |