AsymmetricGenerateKey

Description

Generates the secret key for asymmetric algorithm.

Applies to

CrypterObject objects

Syntax

crypter.AsymmetricGenerateKey ( algorithm, len, privKey, pubKey)

Argument

Description

crypter

The name of the CrypterObject object

algorithm

A value of the AsymmetricAlgorithm enumerated type that specifies the type of asymmetric algorithm.

Values are:

  • RSA! – The Rivest-Shamir-Adleman cryptopsystem

  • DSA! – The Digital Signature Algorithm. It is designed to be used in signature, not in encryption and decryption.

  • Rabin! – The Rabin Algorithm

len

An integer specifying the key length. Recommended key length: 512/1024/2048.

privKey

A blob receiving the private key.

pubKey

A blob receiving the public key.


Return value

Integer. Returns 1 if it succeeds and -1 if it failed. If any argument’s value is null, the method returns null. If an error occurs, throw the exception.

Examples

This statement generates a public key and a private key.

Integer li_return
Blob lblb_privKey
Blob lblb_pubKey

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject

// Generate the key
li_return = lnv_CrypterObject.AsymmetricGenerateKey(RSA!, 1024, lblb_privKey, lblb_pubKey)
if li_return = 1 then
	messagebox("Success", "Key is generated successfully!")
else
	messagebox("Error", "Failed to generate the key!")
end if

See also

SymmetricEncrypt

SymmetricDecrypt

AsymmetricEncrypt

AsymmetricDecrypt

AsymmetricSign

AsymmetricVerifySign

MD5

SHA

HMAC