at.knowcenter.wag.egov.egiz.sig
Class SignatureObject

java.lang.Object
  extended by at.knowcenter.wag.egov.egiz.sig.SignatureObject
All Implemented Interfaces:
Serializable

public class SignatureObject
extends Object
implements Serializable

This class represents the abstract signature object. It contains all methods reading the definitions from the settings file, analyse them and build the abstract signature table.
All values that build or used by the signation creation process, call the external services, can read or set separately. All other values are defined in the settings file.

Author:
wlackner, modified by Thomas Knall
See Also:
Serialized Form

Field Summary
protected static int new_cert_num
          This is an internal counter for added certificates.
protected  String raw_signature_response
          The raw xml response from the connector that was used to set the values in this SignatureObject.
static String SIG_CER
          Standard key get/set the certification value
static String SIG_CER_DIG
          Standard key get/set the certification digest value
static String SIG_META
          Standard key get/set the signature meta informations
 
Constructor Summary
SignatureObject()
          The empty constructor.
 
Method Summary
static boolean decideNewEtsiByBKUVersion(String productVersion)
           
 List fillValues(char placeholder, boolean has_SIG_ID)
           
static String formatSigIds(Properties response_properties, String[] sigIds)
           
 Table getAbstractTable()
           
 PdfASID getKZ()
          Returns the "Kennzeichnung" of this signature.
 String getOfficialSeal()
           
 String getRawSignatureResponse()
          Returns the raw signature response XML string as set by the signing Connector.
 SignatureEntry getSigEntry(String key)
          This method returns a signature entry object.
 String getSignationDate()
           
 String getSignationIds()
          Takes the signation id value of the current SignatureObject and split them into the corresponding id array added with the id-base.
 String getSignationIssuer()
           
 String getSignationName()
           
 String getSignationNormVersion()
           
 String getSignationSerialNumber()
           
 String getSignationType()
           
 String getSignationValue()
           
 SignatureTypeDefinition getSignatureTypeDefinition()
           
 String getSigResponse()
          Dummy getter Method for debugging only
 String getSigValue(String key)
          This method returns a value for a given signature key.
 X509Cert getX509Cert()
           
 X509Cert getX509Cert(String serialNumber, String issuer)
           
 String getX509CertificateDigest()
           
 String getX509CertificateString()
           
 String getX509CertificateString(String serialNumber, String issuer)
          return the 509v3 certificate of the given serialNumber and the given issuer string
 void initByType()
          This method inits the signature object by the given type.
 boolean isBinary()
          Tells, if this SignatureObject is binary.
 boolean isMOASigned()
          Checks if the current SignatureObject is siganted by MOA.
 boolean isSigKey(String sigKey)
          This method checks if a given signature key is realy a defined signature key.
 boolean isTextual()
          Tells if this SignatureObject is textual.
protected  byte[] loadCertificateFromLDAP(String serialNumber, String issuer)
          Connects to the LDAP server to look for the certificate.
static String[] parseSigIds(String sig_ids)
           
 void setKZ(PdfASID kz)
          Sets the "Kennzeichnung".
 void setRawSignatureResponse(String raw_response_string)
          Sets the raw signature response XML string.
 void setSignationDate(String sigDate)
           
 void setSignationIDs(String sigIds)
          Set the signation id's build by a BKU signated SignatureObject.
 void setSignationIssuer(String sigIssuer)
           
 void setSignationName(String sigName)
           
 void setSignationNormVersion(String sigNormVersion)
           
 void setSignationSerialNumber(String serialNumber)
           
 void setSignationValue(String sigValue)
           
 void setSigResponse(String sigRespone)
          Dummy setter Method for debugging only
 void setSigType(String sigType)
          This method set the signature type.
 boolean setSigValue(String key, String value)
          This method adds an signaton value to the entry cache.
 void setSigValueCaption(String key, String value, String caption)
          Set the value and the caption to given key.
 boolean setValueBruteForce(String key, String value)
           
 void setX509Certificate(String x509Certificate)
           
 void setX509CertificateDigest(String certDigest)
           
 void storeNewCertificateInLocalStore(byte[] cert_data)
          Writes the certificate data to a file and stores the file in the local certificate store.
 String toString()
          The toString method, used for tests or debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIG_META

public static final String SIG_META
Standard key get/set the signature meta informations

See Also:
Constant Field Values

SIG_CER

public static final String SIG_CER
Standard key get/set the certification value

See Also:
Constant Field Values

SIG_CER_DIG

public static final String SIG_CER_DIG
Standard key get/set the certification digest value

See Also:
Constant Field Values

raw_signature_response

protected String raw_signature_response
The raw xml response from the connector that was used to set the values in this SignatureObject.

This is set by the Connector so that signing Applications can use the returned XML values.


new_cert_num

protected static int new_cert_num
This is an internal counter for added certificates.

Constructor Detail

SignatureObject

public SignatureObject()
                throws SignatureException
The empty constructor. It initilize the normlizer, load the settings and set the default styles.

Throws:
SignatureException - ErrorCode:101, 400
Method Detail

getSigResponse

public String getSigResponse()
Dummy getter Method for debugging only

Returns:
response string

setSigResponse

public void setSigResponse(String sigRespone)
Dummy setter Method for debugging only

Parameters:
sigRespone - store the response string

setSigType

public void setSigType(String sigType)
                throws SignatureTypesException
This method set the signature type.

Parameters:
sigType - the signature type to be set
Throws:
SignatureTypesException

isSigKey

public boolean isSigKey(String sigKey)
This method checks if a given signature key is realy a defined signature key.

Parameters:
sigKey - the key to check
Returns:
true if the key is correct, false if the given key is not defined

setSigValue

public boolean setSigValue(String key,
                           String value)
This method adds an signaton value to the entry cache. If a key is not in the cache a new signature entry is createad. Therefor the method return true.
The value that has to be set would be normalized!
If the key equals to SIG_VALUE all whitespaces are removed!

Parameters:
key - the key to be set
value - the value to be set
Returns:
true if a new signature value is created, false otherwise

setValueBruteForce

public boolean setValueBruteForce(String key,
                                  String value)

setSigValueCaption

public void setSigValueCaption(String key,
                               String value,
                               String caption)
Set the value and the caption to given key.

Parameters:
key - the key of the signature object
value - the value of the given key
caption - the caption of the given key

getSigValue

public String getSigValue(String key)
This method returns a value for a given signature key. If the key equals to SIG_NORM and the value is null the version string of the current normalizer is returned!

Parameters:
key - the key to get the value for
Returns:
a value for the given key

setKZ

public void setKZ(PdfASID kz)
Sets the "Kennzeichnung".

Parameters:
kz - The "Kennzeichnung" to be set.

getKZ

public PdfASID getKZ()
              throws InvalidIDException
Returns the "Kennzeichnung" of this signature.

Returns:
Returns the "Kennzeichnung" of this signature. Returns null if there is no "Kennzeichnung" or it is not recognized by this application.
Throws:
InvalidIDException

getSignationType

public String getSignationType()
Returns:
Returns the SignationType.

getSignationDate

public String getSignationDate()
Returns:
Returns the SignationDate.

setSignationDate

public void setSignationDate(String sigDate)
Parameters:
sigDate - The SignationDate to set.

getSignationName

public String getSignationName()
Returns:
Returns the SignationName.

setSignationName

public void setSignationName(String sigName)
Parameters:
sigName - The SignationName to set.

getSignationNormVersion

public String getSignationNormVersion()
Returns:
Returns the SignationNormVersion.

setSignationNormVersion

public void setSignationNormVersion(String sigNormVersion)
Parameters:
sigNormVersion - The SignationNormVersion to set.

getSignationIssuer

public String getSignationIssuer()
Returns:
Returns the SignationIssuer.

setSignationIssuer

public void setSignationIssuer(String sigIssuer)
Parameters:
sigIssuer - The SignationIssuer to set.

getSignationValue

public String getSignationValue()
Returns:
Returns the SignationValue.

setSignationValue

public void setSignationValue(String sigValue)
Parameters:
sigValue - The SignationValue to set.

getOfficialSeal

public String getOfficialSeal()
Returns:
the reference to the signature label

setSignationSerialNumber

public void setSignationSerialNumber(String serialNumber)
Parameters:
serialNumber - The serial number of the signature to set

getSignationSerialNumber

public String getSignationSerialNumber()
Returns:
sigNumber the serial number of the signature

setX509CertificateDigest

public void setX509CertificateDigest(String certDigest)
Parameters:
certDigest - set the digest value for the X509Certificate

getX509CertificateDigest

public String getX509CertificateDigest()
Returns:
the current X509CertificateDigest value.

getX509CertificateString

public String getX509CertificateString()
Returns:
the current X509v3 certificate string

setX509Certificate

public void setX509Certificate(String x509Certificate)
Parameters:
x509Certificate - The X509v3 certificate of the signature to set

getX509CertificateString

public String getX509CertificateString(String serialNumber,
                                       String issuer)
return the 509v3 certificate of the given serialNumber and the given issuer string

Parameters:
serialNumber - the serialNumber which the certificates should load
issuer - the issuer which the certificates should load
Returns:
the X509v3 certificate string

getX509Cert

public X509Cert getX509Cert(String serialNumber,
                            String issuer)

getX509Cert

public X509Cert getX509Cert()

setSignationIDs

public void setSignationIDs(String sigIds)
Set the signation id's build by a BKU signated SignatureObject.

Parameters:
sigIds - the string to store.

formatSigIds

public static String formatSigIds(Properties response_properties,
                                  String[] sigIds)
                           throws SignatureException
Throws:
SignatureException

decideNewEtsiByBKUVersion

public static boolean decideNewEtsiByBKUVersion(String productVersion)

isMOASigned

public boolean isMOASigned()
Checks if the current SignatureObject is siganted by MOA. It checks if the current SignatureObject has a signation id value.

Returns:
true if no signation id value is found, false otherwise

isTextual

public boolean isTextual()
Tells if this SignatureObject is textual.

Returns:
Returns true, if it is textual.

isBinary

public boolean isBinary()
Tells, if this SignatureObject is binary.

Returns:
Returns true, if it is binary.

getSignationIds

public String getSignationIds()
Takes the signation id value of the current SignatureObject and split them into the corresponding id array added with the id-base.

Returns:
the id array

parseSigIds

public static String[] parseSigIds(String sig_ids)

storeNewCertificateInLocalStore

public void storeNewCertificateInLocalStore(byte[] cert_data)
Writes the certificate data to a file and stores the file in the local certificate store.

Parameters:
cert_data - The binary certificate data.

loadCertificateFromLDAP

protected byte[] loadCertificateFromLDAP(String serialNumber,
                                         String issuer)
Connects to the LDAP server to look for the certificate.

Parameters:
serialNumber - The serial number String of the certificate being sought. E.g. "123455676744123432".
issuer - The issuer String of the certificate being sought.
Returns:
Returns the DER certificate file as can be stored in the local repository. Returns null, if the document wasn't found on the server.
Throws:
ClassNotFoundException

getAbstractTable

public Table getAbstractTable()
Returns:
Returns the AbstractTable.
See Also:
Table

initByType

public void initByType()
                throws SignatureTypesException
This method inits the signature object by the given type. It loads the configured values and captions from the config.properties file.

Throws:
SignatureTypesException

getSigEntry

public SignatureEntry getSigEntry(String key)
This method returns a signature entry object.

Parameters:
key - the corresponding key
Returns:
the signature entry object of the given key, null if the key does not exist

getSignatureTypeDefinition

public SignatureTypeDefinition getSignatureTypeDefinition()

fillValues

public List fillValues(char placeholder,
                       boolean has_SIG_ID)
Parameters:
placeholder -
Returns:
Returns the list of SignatureFieldDefinitions that's values in the SignatureObject have been filled out with placeholders.

getRawSignatureResponse

public String getRawSignatureResponse()
Returns the raw signature response XML string as set by the signing Connector.

Returns:
Returns the XML response String.

setRawSignatureResponse

public void setRawSignatureResponse(String raw_response_string)
Sets the raw signature response XML string.

This should be used by the Connector to pass the response String to the signer.

Parameters:
raw_response_string - The new raw signature response string.

toString

public String toString()
The toString method, used for tests or debugging.

Overrides:
toString in class Object


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.