at.knowcenter.wag.egov.egiz.sig.connectors.bku
Class BKUHelper

java.lang.Object
  extended byat.knowcenter.wag.egov.egiz.sig.connectors.bku.BKUHelper

public final class BKUHelper
extends Object

Contains static helper methods used by the BKU Connectors.

Author:
wprinz

Constructor Summary
BKUHelper()
           
 
Method Summary
static void checkResponseForError(String response_string)
          Checks the response xml for an error description and if found throws an appropriate exception.
static String formDateTimeElement(Date verificationTime)
           
static String formDateTimeElement(Date verificationTime, String namespace)
           
static String getBKUIdentifier(HttpServletRequest request)
           
static String getBKUIdentifier(Properties parsedResponseProperties)
           
static Properties getBKUProperties(HttpServletRequest request)
           
static SignSignatureObject parseCreateXMLResponse(String xmlResponse, IdFormatter id_formatter, ConnectorEnvironment environment)
          This method parses the BKU-Response string.
static SignatureResponse parseVerifyXMLResponse(String xmlResponse)
          This method parses the verify response string and return a SignatureResponse object.
static String prepareBase64Content(SignatureData data)
          Encodes the given SignatureData to a valid Base64Content.
static byte[] prepareEnvelopingData(SignatureData data)
          Prepares the enveloping data.
static String removeAllWhitespace(String str)
          Removes all whitespaces ("\\s") from the String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BKUHelper

public BKUHelper()
Method Detail

prepareBase64Content

public static String prepareBase64Content(SignatureData data)
Encodes the given SignatureData to a valid Base64Content.

The data is Base64 encoded. If the mime-type suggests that the data is binary, it is Base64 encoded for a second time.

Parameters:
data - The data to be converted to a valid Base64 content.
Returns:
Returns the Base64 content.

prepareEnvelopingData

public static byte[] prepareEnvelopingData(SignatureData data)
Prepares the enveloping data.

This is useful for building the hash.

Parameters:
data - The data to be prepared.
Returns:
Returns the prepared data.

checkResponseForError

public static void checkResponseForError(String response_string)
                                  throws ConnectorException
Checks the response xml for an error description and if found throws an appropriate exception.

Parameters:
response_string - The response xml.
Throws:
ConnectorException - f.e.

parseCreateXMLResponse

public static SignSignatureObject parseCreateXMLResponse(String xmlResponse,
                                                         IdFormatter id_formatter,
                                                         ConnectorEnvironment environment)
                                                  throws ConnectorException
This method parses the BKU-Response string.

It separates the SignatureValue, X509IssuerName, SigningTime, X509SerialNumber, X509Certificate, CertDigest, DigestValue and the signation id-s. If the X509Certificate is extracted it would be stored in the certificates directory.

Parameters:
xmlResponse - The response string.
Returns:
Returns the parsed signature object holding the data.
Throws:
ConnectorException - ErrorCode (303, 304)
See Also:
SignatureObject, CodingHelper, X509Cert

removeAllWhitespace

public static String removeAllWhitespace(String str)
Removes all whitespaces ("\\s") from the String.

Parameters:
str - The String.
Returns:
The String with all whitespaces removed.

parseVerifyXMLResponse

public static SignatureResponse parseVerifyXMLResponse(String xmlResponse)
This method parses the verify response string and return a SignatureResponse object. The SignatureResponse object is filled out by the response values from the BKU-response.

Parameters:
xmlResponse - the response values from the BKU-verify request
Returns:
SignatureResponse object
See Also:
SignatureResponse

formDateTimeElement

public static String formDateTimeElement(Date verificationTime)

formDateTimeElement

public static String formDateTimeElement(Date verificationTime,
                                         String namespace)

getBKUIdentifier

public static String getBKUIdentifier(Properties parsedResponseProperties)

getBKUIdentifier

public static String getBKUIdentifier(HttpServletRequest request)

getBKUProperties

public static Properties getBKUProperties(HttpServletRequest request)


Copyright © 2006-2010. All Rights Reserved.