PreviousNext

pkc_crypto_generate_keypair(3sec)

Generates a pair of public and private keys

Synopsis

#include <pkc_certs.h>

unsigned32 pkc_crypto_generate_keypair(

gss_OID algorithm,

unsigned32 size,

void * alg_info,

sec_pk_data_t * private_key,

sec_pk_data_t * public_key);

Parameters

Input

algorithm
Specifies the crypto module.

size
Specifies the key size.

alg_info
Specifies algorithm-specific information, if any.

Output

private_key
The generated private key.

public_key
The generated public key.

Description

pkc_crypto_generate_keypair generates a pair of public and private keys. The (*generate_keypair)( ) routine of the crypto module specified by algorithm is called to do this (but note that crypto modules are not required to provide a (*generate_keypair)( ) function).

The size parameter will be used by the routine to determine the key size in some way defined by the algorithm; for the RSA algorithm, for example, it should be treated as the number of bits in the key modulus. The private_key and public_key parameters should be expected to return BER-encoded PrivateKeyInfo and SubjectPublicKeyInfo data objects respectively.

The alg_info parameter can be used for algorithm-specific information to modify the key generation process; NULL can be specified.

Return Values

pkc_s_success
Operation successfully completed.

Errors

Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

Related Information

Functions:
pkc_crypto_intro(3sec)
pkc_crypto_get_registered_algorithms(3sec)
pkc_crypto_lookup_algorithm(3sec)
pkc_crypto_register_signature_alg(3sec)
pkc_crypto_sign(3sec)
pkc_crypto_verify_signature(3sec)