|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aaasec.sigserv.csspapp.SignSupportAPI
public class SignSupportAPI
This class defines a Java API for accessing services from a Central Signing Support service.
The support service is available in the form of a deployable .war, which ideally should be deployed on the same server as where the service provider service using this API is deployed, or at least on the same local network. However, it is quite possible to locate the support service anywhere if appropriate security measures are taken, such as through VPN protection.
In addition to obtaining services from a central signing support service, this API also provides a method for validating a signed document using an external TSL Trust signature validation service. Communication with such service should be SSL/TLS protected and appropriate measures should be added to verify the origin of the signature validation report data, through appropriate checks of the server certificate.
This API communicates with associated services through HTTP POST and HTTP GET requests. Before any of the API methods are called, this API must be initialized by setting appropriate values of the following parameters (using their associated setter functions):
maxMessageLength
The maximum length of any data provided to the
API using InputStream objects (Default set to 500 kBytes).
spSupportUrl
The URL to the central signing support service.
tempFileLocation
A file folder where this API can store
temporary files.
validationServiceUrl
The URL to the signature validation service
(Only required if such service is used)
validationPolicy
The name of the validation policy used to
validate signed document (Only required if a validation service is used)
Method Summary | |
---|---|
static byte[] |
getSignedDoc(String signTaskId)
Gets the signed document base64 encoded bytes identified by the sign task ID. |
static URL |
getSignedDocumentUrl(String sigTaskId)
Returns a Url for obtaining the signed document. |
static String |
getValidationReport(InputStream xmlDocIs)
Sends a signed XML document for validation to a preconfigured signature validation service. |
static String |
getValidationReport(InputStream xmlDocIs,
String policy)
Sends a signed XML document for validation to a preconfigured signature validation service. |
static void |
setMaxMessageLength(int messageMaxLength)
Sets the maximum message length that will be allowed in the exchange of data between the requesting service and the central signing support service. |
static void |
setSpSupportUrl(String spSupportUrl)
Sets the URL for the Central signing support service |
static void |
setTempFileLocation(String tempFileLocation)
Specifies the directory where temporary files are stored, holding return data from http post and http get requests. |
static void |
setValidationPolicy(String validationPolicy)
Sets the name of the validation policy that is used when performing signature validation |
static void |
setValidationServiceUrl(String validationServiceUrl)
Sets the URL for a signature validation service |
static String |
signRequest(InputStream docInputStream,
String signerIdAttr,
String signerId,
String idpEntityId,
byte[] signMessage)
Send a HTTP POST message to the central signing support service, requesting a XHTML page to be passed to the client to initiate the central signing process. |
static String |
signRequest(InputStream xmlDocIs,
String signerIdAttr,
String signerId,
String idpEntityId,
String returnUrl,
String spEntityId,
byte[] signMessage,
String sigAlgorithm)
Send a HTTP POST message to the central signing support service, requesting a XHTML page to be passed to the client to initiate the central signing process. |
static String |
signResponse(byte[] sigResponse)
Sends a signing response message obtained from the central signing service to the central signing support service for processing and validation. |
static String |
testCaseRequest(InputStream docInputStream,
String signerIdAttr,
String signerId,
String idpEntityId,
byte[] signMessage,
String ref,
String testCase)
This call sends a request to the SP Support service to generate a testcase request to the signature service. |
static String |
testCaseRequest(InputStream xmlDocIs,
String signerIdAttr,
String signerId,
String idpEntityId,
String returnUrl,
String spEntityId,
byte[] signMessage,
String sigAlgorithm,
String ref,
String testCase)
This call sends a request to the SP Support service to generate a testcase request to the signature service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setSpSupportUrl(String spSupportUrl)
spSupportUrl
- public static void setMaxMessageLength(int messageMaxLength)
messageMaxLength
- Integer specifying the maximum number of bytespublic static void setValidationServiceUrl(String validationServiceUrl)
validationServiceUrl
- public static void setValidationPolicy(String validationPolicy)
validationPolicy
- name of the validation policypublic static void setTempFileLocation(String tempFileLocation)
tempFileLocation
- full path name of the temporary file directorypublic static String signRequest(InputStream docInputStream, String signerIdAttr, String signerId, String idpEntityId, byte[] signMessage)
docInputStream
- An Input stream providing the bytes of the XML
document to be signedsignerIdAttr
- A string representing the attribute OID of the signer
identity. E.g. "1.2.752.29.4.13", not including any type declaratioins,
such as "urn:oid:".signerId
- A string holding the signers identity value in the
identified attributeidpEntityId
- The entityID of the IdP that should identify the
signer in the central signing servicesignMessage
- A html message to be displayed to the signer in the
central signing service
public static String signRequest(InputStream xmlDocIs, String signerIdAttr, String signerId, String idpEntityId, String returnUrl, String spEntityId, byte[] signMessage, String sigAlgorithm)
xmlDocIs
- An Input stream providing the bytes of the document to be
signedsignerIdAttr
- A string representing the attribute OID of the signer
identity. E.g. "1.2.752.29.4.13", not including any type declaratioins,
such as "urn:oid:".signerId
- A string holding the signers identity value in the
identified attributeidpEntityId
- The entityID of the IdP that should identify the
signer in the central signing servicespEntityId
- The entityID of the service provider requesting a
signature. If this parameter is empty, then the default configured SP
entity ID will be selected.returnUrl
- The URL where the response message is returned from the
signing service. This parameter. If this string is null or empty, the
pre-configured return URL in the support service is used.signMessage
- A html message to be displayed to the signer in the
central signing servicesigAlgorithm
- A URI identifier of a requested signature algorithm.
If this string is null or empty, the default algorithm will be used.
public static String testCaseRequest(InputStream docInputStream, String signerIdAttr, String signerId, String idpEntityId, byte[] signMessage, String ref, String testCase)
docInputStream
- An Input stream providing the bytes of the document
to be signedsignerIdAttr
- A string representing the attribute OID of the signer
identity. E.g. "1.2.752.29.4.13", not including any type declaratioins,
such as "urn:oid:".signerId
- A string holding the signers identity value in the
identified attributeidpEntityId
- The entityID of the IdP that should identify the
signer in the central signing servicesignMessage
- A html message to be displayed to the signer in the
central signing serviceref
- A reference to a previous request relevant for the test-case.
This is only applicable for the replay test-case.testCase
- A string identifying the test-case. The test cases are:
oldReq
Generates a request with old date.
predatedReq
Generates a request with a date set in the
future
badReqSig
Generates a request signed by a valid
requester but with a bad signature.
unknownRequester
Generates a request signed by an unknown entity.
replay
Replays a previous request identified by the ref
parameter.
public static String testCaseRequest(InputStream xmlDocIs, String signerIdAttr, String signerId, String idpEntityId, String returnUrl, String spEntityId, byte[] signMessage, String sigAlgorithm, String ref, String testCase)
xmlDocIs
- An Input stream providing the bytes of the XML document
to be signedsignerIdAttr
- A string representing the attribute OID of the signer
identity. E.g. "1.2.752.29.4.13", not including any type declaratioins,
such as "urn:oid:".signerId
- A string holding the signers identity value in the
identified attributeidpEntityId
- The entityID of the IdP that should identify the
signer in the central signing servicespEntityId
- The entityID of the service provider requesting a
signature. If this parameter is empty, then the default configured SP
entity ID will be selected.returnUrl
- The URL where the response message is returned from the
signing service. This parameter. If this string is null or empty, the
pre-configured return URL in the support service is used.signMessage
- A html message to be displayed to the signer in the
central signing servicesigAlgorithm
- A URI identifier of a requested signature algorithm.
If this string is null or empty, the default algorithm will be used.ref
- A reference to a previous request relevant for the test-case.
This is only applicable for the replay test-case.testCase
- A string identifying the test-case. The test cases are:
oldReq
Generates a request with old date.
predatedReq
Generates a request with a date set in the
future
badReqSig
Generates a request signed by a valid
requester but with a bad signature.
unknownRequester
Generates a request signed by an unknown entity.
replay
Replays a previous request identified by the ref
parameter.
public static String signResponse(byte[] sigResponse)
sigResponse
- The bytes of the signing response
"status"
: "response" if a response has been received and
processed,
"signTaskID"
: The unique identifier of this
sign task,
"documentName"
: (empty) Not set by the
support service,
"respSigValid"
: boolean true if the
response was correctly signed,
"signedDocValid"
: boolean
true true if the constucted document has a valid signature,
"validResponse"
: boolean true if the response indicate a
successfull central signing,
"responseCode"
: "101" for
successful signing,
"responseMessage"
: "OK" for
successful signing,
"signingTime"
: Date and time for
signing (Note that this is only a presentation string for the time. A
machine readable time is provided in the sign response XML), * *
"userId"
: An array, holding signers identity
attributes. Each element in the array holds the
elements "name"
(attribute id) and "value"
(attribute value),
"pathLen"
: The number of certs in the signer cert path.
public static byte[] getSignedDoc(String signTaskId)
signTaskId
- identifier of the signing task. This is the value of
the "signTaskID"
parameter in the JSON status report
obtained through the signResponse
method.
public static URL getSignedDocumentUrl(String sigTaskId)
sigTaskId
- identifier of the signing task. This is the value of *
the "signTaskID"
parameter in the JSON status report
obtained through the signResponse
method.
public static String getValidationReport(InputStream xmlDocIs)
xmlDocIs
- An input stream providing the bytes of the signed
document
public static String getValidationReport(InputStream xmlDocIs, String policy)
xmlDocIs
- An input stream providing the bytes of the signed
documentpolicy
- The policy under which the validation is performed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |