hu_KeyPairDuplicate()

Creates a copy of private and public key, and parameter objects.

Synopsis:

#include "hupkc.h"
 
int hu_KeyPairDuplicate(sb_GlobalCtx srcCtx, sb_Params srcParams, sb_PrivateKey srcPriv, sb_PublicKey srcPub, sb_GlobalCtx dstCtx, sb_RngCtx dstRng, sb_YieldCtx dstYield, sb_Params *dstParams, sb_PrivateKey *dstPriv, sb_PublicKey *dstPub)

Since:

BlackBerry 10.0.0

Arguments:

srcCtx

The global context associated with srcParams, srcPriv and srcPub.

srcParams

The parameters object associated with srcCtx, srcPriv and srcPub.

srcPriv

The private key object associated with srcCtx, srcParams and srcPub.

srcPub

The public key object associated with srcCtx, srcParams and srcPriv.

dstCtx

The global context associated with dstParams, dstPriv and dstPub.

dstRng

The RNG context to add to dstParams.

dstYield

The yield context to add to dstParams.

dstParams

The parameters object pointer associated with dstCtx, dstPriv and dstPub.

dstPriv

The private key object pointer associated with dstCtx, dstParams and dstPub.

dstPub

The public key object pointer associated with dstCtx, dstParams and dstPriv.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

The new key and parameter objects will be thread-safe handles to the same underlying key, and permit the keys to be used in multiple threads.

The dstCtx must be compatible with srcCtx which means it should have been created by calling hu_GlobalCtxCopyCrypto() or by other means where the result is indistinguishable from having called hu_GlobalCtxCopyCrypto().

The srcParams must be present, however srcPriv is needed only when dstPriv is to be created. Similarly for srcPub and dstPub. The dstParams must be non-null since it always needs to be created.

The dstParams will not have the sb_RngCtx (if any) that srcParams has because the sb_RngCtx is not thread safe and that would make the dstParams not thread safe. If the dstParams is required to have a sb_RngCtx, it must be explicitly provided. Similarly for a sb_YieldCtx.

Returns: