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:

  • New() to create an instance of an SSLOptions class.
  • IgnoreError(), ClearErrorList() and GetIgnoredErrorList() to manipulate SSL error handling.
  • SetPrivateKeyFileLocation() and PrivateKeyFileLocation() to get and set the private key file location.
  • SetCertificateFileLocation() and CertificateFileLocation() to get and set the certificate file location.
  • SetRootCertificatesLocation() and RootCertificatesLocation() to get and set the root certificates location.
  • SetVerificationFlag() and VerificationFlag() to get and set the SSL verification type.
  • SetVerificationDepth() and VerificationDepth() to get and set the SSL certification verification depth.
  • SetCipherList() and CipherList() to get and set the SSL cipher list
  • SetPrivateKeyPassphrase() and PrivateKeyPassphrase() to get and set the private key file's passphrase.
  • GetLastError() to return a string for the last error that occured.

  • Class Methods Index

     o SSLOptions New ( void )
    Returns a new SSLOptions class, or undefined if an error occured.

    Function Constants Index

    SSL Verification Flags

     o VERIFY_NONE
    Don't bother to do any cert verification
     o VERIFY_RELAXED
    Do a relaxed cert verification. This is the default

    SSL Error Constants

     o X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
    X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
     o X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
    X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
     o X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
    X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
     o X509_V_ERR_CERT_SIGNATURE_FAILURE
    X509_V_ERR_CERT_SIGNATURE_FAILURE
     o X509_V_ERR_CERT_NOT_YET_VALID
    X509_V_ERR_CERT_NOT_YET_VALID
     o X509_V_ERR_CERT_HAS_EXPIRED
    X509_V_ERR_CERT_HAS_EXPIRED
     o X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
    X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
     o X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
    X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
     o X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
    X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
     o X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
    X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
     o X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
    X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
     o X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
    X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
     o X509_V_ERR_INVALID_CA
    X509_V_ERR_INVALID_CA
     o X509_V_ERR_PATH_LENGTH_EXCEEDED
    X509_V_ERR_PATH_LENGTH_EXCEEDED
     o X509_V_ERR_INVALID_PURPOSE
    X509_V_ERR_INVALID_PURPOSE
     o X509_V_ERR_CERT_UNTRUSTED
    X509_V_ERR_CERT_UNTRUSTED
     o X509_V_ERR_CERT_REJECTED
    X509_V_ERR_CERT_REJECTED
     o X509_V_ERR_SUBJECT_ISSUER_MISMATCH
    X509_V_ERR_SUBJECT_ISSUER_MISMATCH
     o X509_V_ERR_AKID_SKID_MISMATCH
    X509_V_ERR_AKID_SKID_MISMATCH
     o X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
    X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
     o X509_V_ERR_KEYUSAGE_NO_CERTSIGN
    X509_V_ERR_KEYUSAGE_NO_CERTSIGN

    Instance Methods Index

     o String CertificateFileLocation ()
    Returns the path to the certificate file.
     o String CipherList()
    Returns the current cipher list string.
     o Integer ClearErrorList()
    Clears the ignored error list.
     o List GetIgnoredErrorList()
    Returns a list of the errors added via IgnoreError().
     o String GetLastError()
    Returns a string containing the text of the last error, if any.
     o Integer IgnoreError( Integer errorConstant )
    Tells the SSL socket negotiation to ignore the specified certificate validation error.
     o String PrivateKeyFileLocation()
    Returns the path to the private key file.
     o String PrivateKeyPassphrase()
    Returns the private key passphrase.
     o String RootCertificatesLocation ()
    Returns the path to the root certificates.
     o Integer SetCertificateFileLocation ( String file )
    Sets the path to the certificate file.
     o Integer SetCipherList( String cipherList )
    Sets the SSL verification cipher list.
     o Integer SetPrivateKeyFileLocation( String file )
    Sets the path to the private key file.
     o Integer SetPrivateKeyPassphrase( String file )
    Sets the private key file passphrase that was used to encrypt the private key file.
     o Integer SetRootCertificatesLocation ( String file )
    Sets the path to the root certificates.
     o Integer SetVerificationFlag ( Integer verificationFlag )
    Sets the SSL certificate verification flag.
     o Integer SetVerificationDepth( Integer verificationDepth)
    Sets the SSL certificate verification depth.
     o Integer VerificationDepth ()
    Returns the verification depth.
     o Integer VerificationFlag()
    Returns the current verification flag value.

    Class Methods

     o New
     SSLOptions New()
            
    

    Returns a new SSLOptions object

    Parameters:
    NONE
    Returns:
    A new SSLOptions object or undefined if there was an error constructing the object.

    Instance Methods

     o CertificateFileLocation
     String CertificateFileLocation( )
    

    No parameters. Returns the certificate file location string.

    Parameters:
    None.
    Returns:
    Returns the certificate file location string.
     o CipherList
     String CipherList( )
    

    No parameters. Returns the current cipher list string.

    Parameters:
    None.
    Returns:
    Returns the current cipher list string.
     o ClearErrorList
     Integer ClearErrorList( )
    

    No parameters. Removes all errors entered by the IgnoreError() function.

    Parameters:
    None.
    Returns:
    Returns 0 for success and -1 if an error occurred.
     o GetIgnoredErrorList
     List GetIgnoredErrorList( )
    

    No parameters. Returns a List of Integers of the errors added via IgnoreError().

    Parameters:
    None.
    Returns:
    Returns a List of Integers of the errors added via IgnoreError().
     o GetLastError
     String GetLastError( )
    

    No parameters. Returns an error string for the last error that occured.

    Parameters:
    None.
    Returns:
    Returns an error string for the last error that occured.
     o 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.
     o PrivateKeyFileLocation
     String PrivateKeyFileLocation( )
    

    No parameters. Returns the private key file location string.

    Parameters:
    None.
    Returns:
    Returns the private key file location string.
     o PrivateKeyPassphrase
     String PrivateKeyPassphrase( )
    

    No parameters. Returns the current private key passphrase string.

    Parameters:
    None.
    Returns:
    Returns the current private key passphrase string.
     o RootCertificatesLocation
     String RootCertificatesLocation( )
    

    No parameters. Returns the root certificates file location string.

    Parameters:
    None.
    Returns:
    Returns the root certificates file location string.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o 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.
     o VerificationDepth
     Integer VerificationDepth( )
    

    No parameters. Returns the current verification depth or -1 if an error occured.

    Parameters:
    None.
    Returns:
    Returns the current verification depth or -1 if an error occured.
     o VerificationFlag
     Integer VerificationFlag( )
    

    No parameters. Returns the current verification flag value or -1 if an error occurred.

    Parameters:
    None.
    Returns:
    Returns 0 for success and -1 if an error occurred.