UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

setPrivateKey Syntax setPrivateKey(key, format, keyLoc, passPhrase, validate, context) Note: This function is case-sensitive. If you want it to be case-insensitive, you must compile your programs using the BASIC command with the -i option. Description The setPrivateKey() function loads the private key into a security context so that it can be used by SSL functions. If the context already had a set private key, it will be replaced. SSL depends on public key crypto algorithms to perform its functions. A pair of keys is needed for each communicating party to transfer data over SSL The public key is usually contained in a certificate, signed by a CA, while the private key is kept secretly by the user. Private key is used to digitally sign a message or encrypt a symmetric secret key to be used for data encryption. For detailed information about the setPrivateKey function, see UniBasic Extensions. Parameters The following table describes each parameter of the syntax. Parameter Description 1-730 UniBasic Commands Reference Key A string containing either the key or path for a key file. Format 1 - PEM (Base64 encoded) format 2 - DER (ASN.1 binary) format KeyLoc 1 - key contained in key string 2 - key is in a file specified by key setPrivateKey Parameters

Parameter Description passPhrase String containing the path phrase required for gaining access to the key. It can be empty if the key is not pass phrase protected. THIS IS NOT RECOMMENDED! Validate 1 - Validate against matching public key 0 - Will not bother to validate Context The security context handle. The following table describes the status of each return code. Return Code Status 0 Success 1 Invalid Security handle 2 Invalid format setPrivateKey Parameters (continued) 3 Invalid key type 4 Key file cannot be accessed (non-existent or wrong pass phrase) 5 Certificate cannot be accessed 6 Private key does not match public key in certificate 7 Private key cannot be interpreted 99 Other errors that prevent private key from being accepted by UniData or UniVerse. setPrivateKey Return Codes setPrivateKey 1-731

Parameter Description<br />

passPhrase String containing the path phrase required for gaining access to the key.<br />

It can be empty if the key is not pass phrase protected. THIS IS NOT<br />

RECOMMENDED!<br />

Validate 1 - Validate against matching public key<br />

0 - Will not bother to validate<br />

Context The security context handle.<br />

The following table describes the status of each return code.<br />

Return<br />

Code Status<br />

0 Success<br />

1 Invalid Security handle<br />

2 Invalid format<br />

setPrivateKey Parameters (continued)<br />

3 Invalid key type<br />

4 Key file cannot be accessed (non-existent or wrong pass phrase)<br />

5 Certificate cannot be accessed<br />

6 Private key does not match public key in certificate<br />

7 Private key cannot be interpreted<br />

99 Other errors that prevent private key from being accepted by<br />

UniData or UniVerse.<br />

setPrivateKey Return Codes<br />

setPrivateKey 1-731

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

Saved successfully!

Ooh no, something went wrong!