com.Sericon.ProductAgents.AutoSSLAgent
Class ProductRegistrationAgent

java.lang.Object
  extended by com.Sericon.ProductAgents.AutoSSLAgent.ProductRegistrationAgent
Direct Known Subclasses:
ProductRegistrationAgentCSR, ProductRegistrationAgentKeystore

public abstract class ProductRegistrationAgent
extends java.lang.Object

This is the main class of the AutoSSL Agent, and one of its subclasses should be instantiated when an application wishes to connect to an AutoSSL Server in order to provision an SSL certificate. The ProductRegistrationAgent will work in one of two modes:

In both cases, the ProductRegistrationAgent is responsible to periodically contact the Naming Server to ensure that the resolution of its DNS name is properly updated, especially if the network that the application runs on has a dynamic IP address.

The ProductRegistrationAgent also requires a directory for it to write data to that it needs to retain between executions.


Method Summary
 void applicationFinished()
          A method for the application to call when it is shutting down.
 int daysUntilCertificateExpires()
          Find out how many days until the certificate expires.
 java.lang.String getBaseDomain()
          Gets the base domain that's used for this application.
 BasicCustomerInfo getCustomerInformation()
          Gets the basic customer information from the SSL certificate that was provisioned to this application.
 java.lang.Object getFTAgent()
          For future development.
 java.lang.String getServerID()
          Gets the serverID for this application.
 java.security.cert.X509Certificate getSSLCertificate()
          Gets the SSL certificate that was provisioned to this application.
 boolean hasCertificate()
          Determine whether or not this application has an SSL certificate.
 void registerForPeriodicServices(java.lang.Object objectTBD)
          Register to connect to services that need to be periodically updated.
Register to periodically connect to the Naming Server, a service of the AutoSSL Server that is responsible for all of the DNS names that are managed by the AutoSSL Server.
 java.lang.String reserveServerID(java.lang.String baseDomain, java.lang.String serverID, java.lang.String serverPassword)
          Queries whether or not the serverID is in use, and if it isn't, reserves it.
 void validateLocationInformation(java.lang.String countryCode, java.lang.String state, java.lang.String city)
          This is a convenience method to validate that a user's location information is well-formed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFTAgent

public java.lang.Object getFTAgent()
For future development. This method is not currently supported.

Returns:
an Object TBD

hasCertificate

public boolean hasCertificate()
Determine whether or not this application has an SSL certificate.

Returns:
true if there was ever a certificate provisioned, regardless of whether or not is is now out of date.

daysUntilCertificateExpires

public int daysUntilCertificateExpires()
                                throws PRAException
Find out how many days until the certificate expires. An application should warn the user a few days before his certificate will expire and allow him to easily renew it.

Returns:
The number of days until the certificate expires. If the certificate has already expired, then this number will be negative, and will say how many days the certificate has been expired.
Throws:
PRAException - An exception has occurred during the processing of this method, such as there not being a certificate provisioned to this application.

getSSLCertificate

public java.security.cert.X509Certificate getSSLCertificate()
                                                     throws PRAException
Gets the SSL certificate that was provisioned to this application.

Returns:
An X.509 certificate that was signed by a trusted CA.
Throws:
PRAException

applicationFinished

public void applicationFinished()
A method for the application to call when it is shutting down. This allows the AutoSSL Agent to do any cleanup that is necessary.


getCustomerInformation

public BasicCustomerInfo getCustomerInformation()
                                         throws PRAException
Gets the basic customer information from the SSL certificate that was provisioned to this application.

Returns:
BasicCustomerInfo object that contains the customer's information.
Throws:
PRAException - - For instance, there is no certificate provisioned.

getServerID

public java.lang.String getServerID()
Gets the serverID for this application.

Returns:
String containing the serverID.

getBaseDomain

public java.lang.String getBaseDomain()
Gets the base domain that's used for this application. This value, along with the serverID are used to create the DNS name where you can find this application running.

Returns:
String containing the base domain.

reserveServerID

public java.lang.String reserveServerID(java.lang.String baseDomain,
                                        java.lang.String serverID,
                                        java.lang.String serverPassword)
                                 throws PRAException
Queries whether or not the serverID is in use, and if it isn't, reserves it. This method is useful for applications that wish to seperate the gathering of basic information such as location and serverID from the gathering of authentication information. Doing things this way is beneficial to consumers who can test whether certain serverIDs are available before offering their authentication information, such as credit card numbers. If the serverID is not currently in use, it will be reserved on the AutoSSL Server for 10 minutes.

Parameters:
baseDomain - The domain that will be used to create the DNS names that will be given to consumers as part of their product registration. These DNS names will be subdomains of this base domain. This base domain should be in its most simple form, as it will be the basis of other domain names. For example, you should use autossl.com instead of www.autossl.com.
serverID - The server ID that's to be used for this instance of the application. This, along with the base domain, will combine to make the host name that will be used to locate this running instance on the Internet (i.e. it will be the DNS name).
serverPassword - Password to be used for the communication with the AutoSSL Server. This string may come from the user, or be generated randomly per device.
Returns:
A string that must be used be passed in to further calls of provisionSSLCertificate(...)
Throws:
PRAException - - This exception will contain the reason for failure if the serverID cannot be reserved

registerForPeriodicServices

public void registerForPeriodicServices(java.lang.Object objectTBD)
                                 throws PRAException
Register to connect to services that need to be periodically updated.
Register to periodically connect to the Naming Server, a service of the AutoSSL Server that is responsible for all of the DNS names that are managed by the AutoSSL Server. This will ensure that the Naming Server knows the correct location of the running application. This must happen periodically if the network that the product is running on is using a dynamic IP address.

Parameters:
objectTBD - For future development. Must be set to null.
Throws:
PRAException

validateLocationInformation

public void validateLocationInformation(java.lang.String countryCode,
                                        java.lang.String state,
                                        java.lang.String city)
                                 throws PRAException
This is a convenience method to validate that a user's location information is well-formed. We provide this so that applications may check whether the information that users provide will be acceptable to the AutoSSL Server when the time comes to generate the certificate. If there is an error with the data the user provided, we can catch this and fix it before the user pays for anything. This method will check the following things:

Parameters:
countryCode - A valid ISO 3166-1 alpha-2 code
state - The name of the state or province, or an empty string if none exists
city - The non-blank name of the city
Throws:
PRAException - - This exception will contain the reason for failure if the location is not valid