The built-in functions in the SSLOptions Package allow
the SMTPSession and POP3Session to communicate using SSL sockets and configure the SSL options as required.
The SSLOptions Package offers the following functionality:
-
SSLOptions New ( void )
- Returns a new SSLOptions class, or undefined if an error occured.
SSL Verification Flags
-
VERIFY_NONE
- Don't bother to do any cert verification
-
VERIFY_RELAXED
- Do a relaxed cert verification. This is the default
SSL Error Constants
-
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
- X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
-
X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
- X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
-
X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
- X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
-
X509_V_ERR_CERT_SIGNATURE_FAILURE
- X509_V_ERR_CERT_SIGNATURE_FAILURE
-
X509_V_ERR_CERT_NOT_YET_VALID
- X509_V_ERR_CERT_NOT_YET_VALID
-
X509_V_ERR_CERT_HAS_EXPIRED
- X509_V_ERR_CERT_HAS_EXPIRED
-
X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
- X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
-
X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
- X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
-
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
- X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
-
X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
- X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
-
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
-
X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
- X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
-
X509_V_ERR_INVALID_CA
- X509_V_ERR_INVALID_CA
-
X509_V_ERR_PATH_LENGTH_EXCEEDED
- X509_V_ERR_PATH_LENGTH_EXCEEDED
-
X509_V_ERR_INVALID_PURPOSE
- X509_V_ERR_INVALID_PURPOSE
-
X509_V_ERR_CERT_UNTRUSTED
- X509_V_ERR_CERT_UNTRUSTED
-
X509_V_ERR_CERT_REJECTED
- X509_V_ERR_CERT_REJECTED
-
X509_V_ERR_SUBJECT_ISSUER_MISMATCH
- X509_V_ERR_SUBJECT_ISSUER_MISMATCH
-
X509_V_ERR_AKID_SKID_MISMATCH
- X509_V_ERR_AKID_SKID_MISMATCH
-
X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
- X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
-
X509_V_ERR_KEYUSAGE_NO_CERTSIGN
- X509_V_ERR_KEYUSAGE_NO_CERTSIGN
-
String CertificateFileLocation ()
- Returns the path to the certificate file.
-
String CipherList()
- Returns the current cipher list string.
-
Integer ClearErrorList()
- Clears the ignored error list.
-
List GetIgnoredErrorList()
- Returns a list of the errors added via IgnoreError().
-
String GetLastError()
- Returns a string containing the text of the last error, if any.
-
Integer IgnoreError(
Integer errorConstant )
- Tells the SSL socket negotiation to ignore the specified certificate validation error.
-
String PrivateKeyFileLocation()
- Returns the path to the private key file.
-
String PrivateKeyPassphrase()
- Returns the private key passphrase.
-
String RootCertificatesLocation ()
- Returns the path to the root certificates.
-
Integer SetCertificateFileLocation (
String file )
- Sets the path to the certificate file.
-
Integer SetCipherList(
String cipherList )
- Sets the SSL verification cipher list.
-
Integer SetPrivateKeyFileLocation(
String file )
- Sets the path to the private key file.
-
Integer SetPrivateKeyPassphrase(
String file )
- Sets the private key file passphrase that was used to encrypt the private key file.
-
Integer SetRootCertificatesLocation (
String file )
- Sets the path to the root certificates.
-
Integer SetVerificationFlag (
Integer verificationFlag )
- Sets the SSL certificate verification flag.
-
Integer SetVerificationDepth(
Integer verificationDepth)
- Sets the SSL certificate verification depth.
-
Integer VerificationDepth ()
- Returns the verification depth.
-
Integer VerificationFlag()
- Returns the current verification flag value.
New
SSLOptions New()
Returns a new SSLOptions object
- Parameters:
-
- Returns:
- A new SSLOptions object or undefined if there was an error constructing the object.
CertificateFileLocation
String CertificateFileLocation( )
No parameters. Returns the certificate file location string.
- Parameters:
-
- Returns:
- Returns the certificate file location string.
CipherList
String CipherList( )
No parameters. Returns the current cipher list string.
- Parameters:
-
- Returns:
- Returns the current cipher list string.
ClearErrorList
Integer ClearErrorList( )
No parameters. Removes all errors entered by the IgnoreError() function.
- Parameters:
-
- Returns:
- Returns 0 for success and -1 if an error occurred.
GetIgnoredErrorList
List GetIgnoredErrorList( )
No parameters. Returns a List of Integers of the errors added via IgnoreError().
- Parameters:
-
- Returns:
- Returns a List of Integers of the errors added via IgnoreError().
GetLastError
String GetLastError( )
No parameters. Returns an error string for the last error that occured.
- Parameters:
-
- Returns:
- Returns an error string for the last error that occured.
IgnoreError
Integer IgnoreError(
Integer errorConstant )
Sets certificate verification errors to be ignored when doing an SSL negotiation.
- Parameters:
-
errorConstant |
- |
Any of the SSL Error Constants above. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
PrivateKeyFileLocation
String PrivateKeyFileLocation( )
No parameters. Returns the private key file location string.
- Parameters:
-
- Returns:
- Returns the private key file location string.
PrivateKeyPassphrase
String PrivateKeyPassphrase( )
No parameters. Returns the current private key passphrase string.
- Parameters:
-
- Returns:
- Returns the current private key passphrase string.
RootCertificatesLocation
String RootCertificatesLocation( )
No parameters. Returns the root certificates file location string.
- Parameters:
-
- Returns:
- Returns the root certificates file location string.
SetCertificateFileLocation
Integer SetCertificateFileLocation(
String filepath )
Sets the location of the local certificate file to be used for SSL negotiations. This file may also contain the private key. The expected file format is PEM.
- Parameters:
-
filepath |
- |
Fully qualified filepath to the certificate file. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetCipherList
Integer SetCipherList(
String cipherList )
Don't mess with this unless you really know what you're doing. Default is "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH". Conforms to OpenSSL conventions.
- Parameters:
-
cipherList |
- |
cipher list to use |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetPrivateKeyFileLocation
Integer SetPrivateKeyFileLocation(
String filepath )
Sets the location of the private key file to be used for SSL negotiations.
- Parameters:
-
filepath |
- |
Fully qualified filepath to the private key file. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetPrivateKeyPassphrase
Integer SetPrivateKeyPassphrase(
String passPhrase )
The passphrase parameter is used if your private key file is also password encrypted.
- Parameters:
-
passPhrase |
- |
private key passphrase. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetRootCertificatesLocation
Integer SetRootCertificatesLocation(
String filepath )
The file parameter can be either a directory where the CA certificates are stored or a filename of a PEM format file that contains the root CA certs.
- Parameters:
-
filepath |
- |
Fully qualified filepath to the certificate file or fully qualified directory path. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetVerificationDepth
Integer SetVerificationDepth(
Integer depth )
The depth param is a number from 1 to 9 ( the maximum depth ) for how deeply into the cert tree the validation will proceed. Default is 9.
- Parameters:
-
depth |
- |
The depth param is a number from 1 to 9 ( the maximum depth ) for how deeply into the cert tree the validation will proceed. Default is 9. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
SetVerificationFlag
Integer SetVerificationFlag(
Integer flag )
The flag parameter can be either SSLOptions.VERIFY_NONE or SSLOptions.VERIFY_RELAXED. Default is SSLOptions.VERIFY_RELAXED.
- Parameters:
-
flag |
- |
Fully qualified filepath to the certificate file or fully qualified directory path. |
- Returns:
- Returns 0 for success and -1 if an error occurred.
VerificationDepth
Integer VerificationDepth( )
No parameters. Returns the current verification depth or -1 if an error occured.
- Parameters:
-
- Returns:
- Returns the current verification depth or -1 if an error occured.
VerificationFlag
Integer VerificationFlag( )
No parameters. Returns the current verification flag value or -1 if an error occurred.
- Parameters:
-
- Returns:
- Returns 0 for success and -1 if an error occurred.