S60 Open C
libcrypto API Specification

libcrypto API Specification

Table of Contents

API Description
API Categories
Symmetric Ciphers
Public Key Cryptography and Key Agreement
Certificates
Authentication Codes and Hash Functions
Auxiliary Functions
Input/Output and Data Encoding
Internal Functions
General Functions

 


API Description

This chapter defines various sub-libraries and its functionalities.

 


API Categories

libcrypto consists of a number of sub-libraries that implement the individual algorithms. The functionality includes symmetric encryption, public key cryptography and key agreement, certificate handling, cryptographic hash functions and a cryptographic pseudo-random number generator.

The application or project that intends to use Open SSL must mention the paths as shown below:

SYSTEMINCLUDE   \epoc32\include\stdapis
SYSTEMINCLUDE   \epoc32\include\stdapis\openssl

The applications and projects that intend to use the different sub-modules of libcrypto individually, must include crypto.h before the sub-module's corresponding header file.

 


Public Key Cryptography and Key Agreement

Public Key Cryptography and Key Agreement

Function

Description

dsa Implements the Digital Signature Algorithm (DSA).
dh Implements the Diffie-Hellman key agreement protocol.
DH_generate_key, DH_compute_key Performs Diffie-Hellman key exchange.
DH_generate_parameters, DH_check Generates and check Diffie-Hellman parameters.
DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data Adds application specific data to DH structures.
DH_new, DH_free Allocates and frees DH objects.
DH_set_default_method, DH_get_default_method, DH_set_method, DH_new_method DH_OpenSSL Selects DH method.
DH_size Gets Diffie-Hellman prime size.
rsa Implements RSA public key crypto system.
DSA_do_sign,DSA_do_verify Raw DSA signature operations.
DSA_dup_DH Creates a DH structure out of DSA structure.
DSA_generate_key Generates DSA key pair.
DSA_generate_parameters Generates DSA parameters.
DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data Adds application specific data to DSA structures.
DSA_new, DSA_free Allocates and frees DSA objects.
DSA_set_default_method, DSA_get_default_method, DSA_set_method, DSA_new_method DSA_OpenSSL Selects DSA method.
DSA_SIG_new, DSA_SIG_free Allocates and frees DSA signature objects.
DSA_sign, DSA_sign_setup, DSA_verify DSA signatures.
DSA_size Gets DSA signature size.
RSA_blinding_on, RSA_blinding_off Protects the RSA operation from timing attacks.
RSA_check_key Validates private RSA keys.
RSA_generate_key_ex Generates RSA key pair.
RSA_get_ex_new_index, RSA_set_ex_data,RSA_get_ex_data Add application specific data to RSA structures.
RSA_new, RSA_free Allocate and free RSA objects.
RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1, RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, RSA_padding_add_SSLv23, RSA_padding_check_SSLv23, RSA_padding_add_none, RSA_padding_check_none Asymmetric encryption padding.
RSA_print, RSA_print_fp, DSAparams_print, DSAparams_print_fp, DSA_print, DSA_print_fp, DHparams_print, DHparams_print_fp Print cryptographic parameters.
RSA_private_encrypt, RSA_public_decrypt Low level signature operations.
RSA_public_encrypt, RSA_private_decrypt Public key cryptography.
RSA_set_default_method, RSA_get_default_method, RSA_set_method, RSA_get_method, RSA_PKCS1_SSLeay, RSA_null_method, RSA_flags, RSA_new_method Select RSA method.
RSA_sign, RSA_verify RSA signatures.
RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING RSA signatures.
RSA_size Gets RSA modulus size

 


Certificates

Certificates

Function

Description

x509 X.509 certificate handling.
x509v3() X.509 version3 certificate handling.

 


Authentication Codes and Hash Functions

Authentication Codes and Hash Functions

Function

Description

hmac, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup HMAC message authentication code.
MD2, MD5, MD2_Init, MD2_Update, MD2_Final, MD5_Init, MD5_Update, MD5_Final Cryptographic hash functions with a 128 bit output.
SHA1, SHA1_Init, SHA1_Update, SHA1_Final SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160 bit output.

 


Auxiliary Functions

Auxiliary Functions

Function

Description

err Error codes contain information about where the error occurred, and what went wrong.
ERR_clear_error Clears the error queue.
ERR_error_string, ERR_error_string_n, ERR_lib_error_string, ERR_func_error_string, ERR_reason_error_string Obtain human-readable error message.
ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data Obtain error code and data.
ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON Get library, function and reason code.
ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings Load and free error strings.
ERR_load_strings, ERR_PACK, ERR_get_next_error_library Load arbitrary error strings.
ERR_print_errors, ERR_print_errors_fp Print error messages.
ERR_put_error, ERR_add_error_data Record an error.
ERR_remove_state Free a thread's error queue.
ERR_set_mark, ERR_pop_to_mark Set marks and pop errors until mark.
CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks, CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback, CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid, CRYPTO_destroy_dynlockid, CRYPTO_lock OpenSSL thread support.
rand Implements a cryptographically secure pseudo-random number generator (PRNG).
RAND_add, RAND_seed, RAND_status Add entropy to the PRNG.
RAND_bytes, RAND_pseudo_bytes Generate random data.
RAND_cleanup Erases the PRNG state.
RAND_egd Queries entropy gathering daemon.
RAND_load_file, RAND_write_file, RAND_file_name PRNG seed file.
RAND_set_rand_method, RAND_get_rand_method, RAND_SSLeay Select RAND method.
OPENSSL_VERSION_NUMBER, SSLeay,SSLeay_version Gets OpenSSL version number.

 


Input/Output and Data Encoding

Input/Output and Data Encoding

Function

Description

ASN1_generate_nconf, ASN1_generate_v3 ASN1 generation functions.
ASN1_OBJECT_new, ASN1_OBJECT_free Object allocation functions.
ASN1_STRING_length, ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data ASN1_STRING utility functions.
ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free ASN1_STRING allocation functions.
ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp ASN1_STRING output routines.
bio I/O abstraction, hides many of the underlying I/O details from an application.
BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, BIO_get_info_callback, BIO_set_info_callback BIO control operations.s
BIO_f_base64 Base64 BIO filter.
BIO_f_buffer Returns the buffering BIO method.
BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx Returns the cipher BIO method.
BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx Message digest BIO filter.
BIO_f_null Returns the null filter BIO method. This is a filter BIO that does nothing.
BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, BIO_ssl_shutdown Returns the SSL BIO method.
BIO_find_type, BIO_next BIO chain traversal.
BIO_new, BIO_set, BIO_free, BIO_vfree BIO_free_all BIO allocation and freeing functions.
BIO_push, BIO_pop Adds and removes BIOs from a chain.
BIO_read, BIO_write, BIO_gets,BIO_puts BIO I/O functions.
BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port, BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode, BIO_get_bind_mode, BIO_do_accept Returns the accept BIO method.
BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request Returns the method for a BIO pair.
BIO_s_connect, BIO_set_conn_hostname, BIO_set_conn_port, BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname, BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port, BIO_set_nbio, BIO_do_connect Returns the connect BIO method.
BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd File descriptor BIO.
BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, BIO_read_filename, BIO_write_filename, BIO_append_filename, BIO_rw_filename Returns the BIO file method.
BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, BIO_get_mem_ptr, BIO_new_mem_buf Returns the memory BIO method function.
BIO_s_null Null data sink.
BIO_s_socket, BIO_new_socket Returns the socket BIO method.
BIO_set_callback, BIO_get_callback,BIO_set_callback_arg, BIO_get_callback_arg, BIO_debug_callback Sets and retrieves the BIO callback.
BIO_should_retry, BIO_should_read, BIO_should_write, BIO_should_io_special, BIO_retry_type, BIO_get_retry_BIO, BIO_get_retry_reason BIO retry functions.
evp Provides a high-level interface to cryptographic functions.
EVP_BytesToKey Password based encryption routine.
EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_MD_CTX_cleanup,EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, EVP_MD_CTX_copy_ex EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_md_null, EVP_md2, EVP_md5, EVP_sha, VP_sha1, EVP_dss, EVP_dss1, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj EVP digest routines.
EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherUpdate,EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX_cleanup, EVP_EncryptInit, EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherFinal, EVP_get_cipherbyname, EVP_get_cipherbynid, EVP_get_cipherbyobj,EVP_CIPHER_nid,EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, 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 EVP cipher routines.
EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal EVP envelope decryption.
EVP_PKEY_new, EVP_PKEY_free Private key allocation functions.
EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, EVP_PKEY_type EVP_PKEY assignment functions.
EVP_SealInit, EVP_SealUpdate, EVP_SealFinal EVP envelope encryption.
EVP_SignInit, EVP_SignUpdate, EVP_SignFinal EVP signing functions.
EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal EVP signature verification functions.
pem Reads or writes structures in PEM format.
pkcs7, pkcs12  
PKCS12_create Create a PKCS#12 structure.
PKCS12_parse Parses a PKCS12 structure.
PKCS7_decrypt Decrypts content from a PKCS#7 enveloped Data structure.
PKCS7_encrypt Creates and returns a PKCS#7 enveloped Data structure.
PKCS7_sign creates and returns a PKCS#7 signedData structure.
PKCS7_verify verifies a PKCS#7 signedData structure.
SMIME_read_PKCS7 Parses S/MIME message.
SMIME_write_PKCS7 Converts PKCS#7 structure to S/MIME format.

 


Internal Functions

Internal Functions

Function

Description

bn Performs arithmetic operations on integers of arbitrary size.
BN_add, BN_sub,BN_mul, BN_sqr, BN_div,BN_mod, BN_nnmod, BN_mod_add, BN_mod_sub, BN_mod_mul, BN_mod_sqr,BN_exp, BN_mod_exp, BN_gcd Arithmetic operations on BIGNUMs.
BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word Arithmetic functions on BIGNUMs with integers.
BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param Blinding related BIGNUM functions.
BN_bn2bin, BN_bin2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn Format conversions.
BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd BIGNUM comparison and test functions.
BN_copy,BN_dup Copies BIGNUMs.
BN_CTX_new, BN_CTX_init, Allocates and frees BN_CTX structures.
BN_CTX_start, BN_CTX_get, BN_CTX_end Uses temporary BIGNUM variables.
BN_generate_prime, BN_is_prime,BN_is_prime_fasttest Generates primes and test for primality.
bn_mul_words, bn_mul_add_words, bn_sqr_words, bn_div_words, bn_add_words, bn_sub_words, bn_mul_comba4, bn_mul_comba8, bn_sqr_comba4, bn_sqr_comba8, bn_cmp_words, bn_mul_normal, bn_mul_low_normal, bn_mul_recursive, bn_mul_part_recursive, bn_mul_low_recursive, bn_mul_high, bn_sqr_normal, bn_sqr_recursive, bn_expand, bn_wexpand, bn_expand2, bn_fix_top,bn_check_top, bn_print, bn_dump, bn_set_max, bn_set_high, bn_set_low BIGNUM library internal functions.
BN_mod_inverse Computes inverse modulo n.
BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init, BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, BN_from_montgomery, BN_to_montgomery Montgomery multiplication.
BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_init, BN_RECP_CTX_free, BN_RECP_CTX_set Performs an efficient BN_mod_mul() operation when the operation will be performed repeatedly with the same modulus.
BN_new, BN_init, BN_clear, BN_free, BN_clear_free Allocates and frees BIGNUMs.
BN_num_bits, BN_num_bytes, BN_num_bits_word Gets BIGNUM size.
BN_rand, BN_pseudo_rand Generates pseudo-random number.
BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, BN_lshift1, BN_rshift, BN_rshift1 Performs bit operations on BIGNUMs.
BN_swap Exchanges BIGNUMs.
BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word BIGNUM assignment operations.
BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup Handles simple character arrays. .
lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall,lh_doall_arg,lh_error Implements dynamic hash tables.
lh_stats, lh_node_stats, lh_node_usage_stats, lh_stats_bio, lh_node_stats_bio, lh_node_usage_stats_bio LHASH statistics.
OBJ_nid2obj, OBJ_nid2ln, OBJ_nid2sn, OBJ_obj2nid, OBJ_txt2nid, OBJ_ln2nid, OBJ_sn2nid, OBJ_cmp, OBJ_dup, OBJ_txt2obj, OBJ_obj2txt, OBJ_create, OBJ_cleanup ASN1 object utility functions.
objects ASN1 object utility functions.
stack Generic implementation of stacks.
txt_db Simple text based in memory database.

 


General Functions

General Functions

Function

Description

CONF_modules_free, CONF_modules_load, CONF_modules_unload OpenSSL configuration cleanup functions.
CONF_modules_load_file, CONF_modules_load OpenSSL configuration functions.
CRYPTO_set_ex_data, CRYPTO_get_ex_data Internal application specific data functions.
CRYPTO_cleanup_all_ex_data This function is used to cleanup application specific data and should be called before the application shuts down to avoid memory leaks.
vd2i_ASN1_OBJECT, i2d_ASN1_OBJECT ASN1 OBJECT IDENTIFIER functions.
d2i_DHparams, i2d_DHparams PKCS#3 DH parameter functions.
d2i_DSAPublicKey, i2d_DSAPublicKey, d2i_DSAPrivateKey, i2d_DSAPrivateKey, d2i_DSA_PUBKEY, i2d_DSA_PUBKEY, d2i_DSA_SIG, i2d_DSA_SIG DSA key encoding and parsing functions.
d2i_PKCS8PrivateKey, d2i_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_bio, i2d_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_nid_bio, i2d_PKCS8PrivateKey_nid_fp PKCS#8 format private key functions.
d2i_RSAPublicKey, i2d_RSAPublicKey, d2i_RSAPrivateKey, i2d_RSAPrivateKey, d2i_RSA_PUBKEY,i2d_RSA_PUBKEY, i2d_Netscape_RSA, d2i_Netscape_RSA RSA public and private key encoding functions.
d2i_X509, i2d_X509, d2i_X509_bio,d2i_X509_fp, i2d_X509_bio, i2d_X509_fp X509 encode and decode functions.
d2i_X509_ALGOR, i2d_X509_ALGOR Algorithm Identifier functions.
d2i_X509_CRL,i2d_X509_CRL, d2i_X509_CRL_bio, d2i_509_CRL_fp, i2d_X509_CRL_bio, i2d_X509_CRL_fp PKCS#10 certificate request functions.
d2i_X509_NAME, i2d_X509_NAME X509_NAME encoding functions.
d2i_X509_REQ, i2d_X509_REQ, d2i_X509_REQ_bio, d2i_X509_REQ_fp, i2d_X509_REQ_bio, i2d_X509_REQ_fp PKCS#10 certificate request functions.
d2i_X509_SIG, i2d_X509_SIG DigestInfo functions.
engine ENGINE cryptographic module support.
OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests Add algorithms to internal table.
OPENSSL_Applink Glue between OpenSSL BIO and Win32 compiler run-time.
OPENSSL_config, OPENSSL_no_config Simple OpenSSL configuration functions.
OPENSSL_ia32cap Finding the IA-32 processor capabilities.
OPENSSL_load_builtin_modules Adds all the standard OpenSSL configuration modules to the internal list.
UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string, UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean, UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string, UI_add_error_string, UI_dup_error_string, UI_construct_prompt, UI_add_user_data, UI_get0_user_data, UI_get0_result, UI_process, UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method, UI_set_method, UI_OpenSSL, ERR_load_UI_strings New User Interface functions.
X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, X509_NAME_add_entry_by_NID, X509_NAME_add_entry, X509_NAME_delete_entry X509_NAME modification functions.
X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, X509_NAME_ENTRY_create_by_OBJ X509_NAME_ENTRY utility functions.
X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ X509_NAME lookup and enumeration functions.
X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print, X509_NAME_oneline X509_NAME printing routines.
X509_new, X509_free X509 certificate ASN1 allocation functions.

Give feedback of this article


©Nokia 2007

Back to top


This material, including documentation and any related computer programs, is protected by copyright controlled by Nokia. All rights are reserved. Copying, including reproducing, storing, adapting or translating, any or all of this material requires the prior written consent of Nokia. This material also contains confidential information, which may not be disclosed to others without the prior written consent of Nokia.

Nokia is a registered trademark of Nokia Corporation. S60 and logo is a trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. Other company and product names mentioned herein may be trademarks or tradenames of their respective owners.