11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

generateKey<br />

Syntax<br />

generateKey(priveKey, pubKey, format, keyLoc, algorithm, keyLength, passPhrase,<br />

paramFile)<br />

Note: This function is case-sensitive. If you want it to be case-insensitive, you<br />

must compile your programs using the BASIC command with the -i option.<br />

Description<br />

The generateKey() function generates a public key cryptography key pair and<br />

encrypts the private key. You should then put it into an external key file protected by<br />

the provided pass phrase. UniData SSL sessions can use the protected private key<br />

later to secure communication. The public key will not be encrypted.<br />

The generated private key will be in PKCS #8 form and is encoded in either PEM or<br />

DER format specified by format. The generated public key is in traditional form. If<br />

keyLoc is 1, the resulted key is put into a dynamic array in privKey and pubKey.<br />

Otherwise, they are put into OS level files specified by privKey and pubKey.<br />

To make sure the private key is protected, you must provide a pass phrase. UniData<br />

uses a one-way hash function to derive a symmetric key from the pass phrase to<br />

encrypt the generated key. When installing the private key into a security context with<br />

the setPrivateKey() function, or generating a certificate request with the generate-<br />

CertRequest() function, you must provide this pass phrase to gain access to the<br />

private key.<br />

For detailed information about the generateKey function, see <strong>UniBasic</strong> Extensions.<br />

1-284 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!