The SetRandomKeyPair method uses the Xceed Encryption Library's random number generator to create a Public Key + Private Key pair for use by a public-key encryption algorithm.
Calling this method causes the PublicKey and the PrivateKey properties to be automatically set to the generated key pair.
Parameter | Description |
---|---|
nKeySize | The strength (in bits) of the Public Key and the Private Key pair to produce. The actual length of the Public Key and Private Key are variable and cannot be determined in advance. The Private Key is always longer than the public key, so that encryption is faster than decryption as a courtesy to users of the Public Key. A key size of 2048 bits is recommended. Key generation is a rather long process, and large keys take extra long. A 2048-bit key can take between 1 and 30 seconds to produce, depending on the computer's processor speed. More information can be found on the rsasecurity site. The key size must be between 1024 and 7128 inclusively. |
vaSeed | This optional parameter (which can be empty or null) allows you to explicitly specify the seed to use for the PGP-style pseudo-random number generator used in the RSA key generation process. This replaces the seed generated by the Xceed Encryption Library as described below in the "remarks" section. |
None
PublicKey and PrivateKey
For this method, only the seed for random numbers is generated by the Xceed Encryption Library random number generator. The actual random numbers are generated by the same pseudo-random number generator algorithm that the PGP system uses.
Declaration (DXceedEncryption) | Copy Code |
---|---|
HRESULT SetRandomKeyPair( [in] short nKeySize, [in] VARIANT* vaSeed ) |
Declaration (IXceedEncryption) | Copy Code |
---|---|
|