Class DefaultPKIMessageParser
- java.lang.Object
-
- org.certificateservices.messages.pkimessages.DefaultPKIMessageParser
-
- All Implemented Interfaces:
PKIMessageParser
public class DefaultPKIMessageParser extends java.lang.Object implements PKIMessageParser
Default implementation of a PKI Message parser generating and signing messages accordning to the specification.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_MESSAGE_NAME_CATALOGUE_IMPLstatic java.lang.StringSETTING_MESSAGE_NAME_CATALOGUE_IMPLstatic java.lang.StringSETTING_REQUIRESIGNATUREstatic java.lang.StringSETTING_SIGNstatic java.lang.StringSETTING_SOURCEID
-
Constructor Summary
Constructors Constructor Description DefaultPKIMessageParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]genChangeCredentialStatusRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String serialNumber, int newCredentialStatus, java.lang.String reasonInformation, Credential originator)Method to generate a ChangeCredentialStatusRequestPKIMessageResponseDatagenChangeCredentialStatusResponse(java.lang.String relatedEndEntity, PKIMessage request, java.lang.String issuerId, java.lang.String serialNumber, int credentialStatus, java.lang.String reasonInformation, java.util.Date revocationDate)Method to generate a ChangeCredentialStatusResponsebyte[]genFetchHardTokenDataRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String tokenSerial, java.lang.String relatedCredentialSerialNumber, java.lang.String relatedCredentialIssuerId, Credential adminCredential, Credential originator)Method to generate a FetchHardTokenDataRequestPKIMessageResponseDatagenFetchHardTokenDataResponse(java.lang.String relatedEndEntity, PKIMessage request, java.lang.String tokenSerial, byte[] encryptedData)Method to generate a FetchHardTokenDataResponsebyte[]genGetCredentialRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String credentialSubType, java.lang.String issuerId, java.lang.String serialNumber, Credential originator)Method to generate a GetCredentialRequestPKIMessageResponseDatagenGetCredentialResponse(java.lang.String relatedEndEntity, PKIMessage request, Credential credential)Method to generate a GetCredentialResponsebyte[]genGetCredentialStatusListRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.Long serialNumber, java.lang.String credentialStatusListType, Credential originator)Method to generate a GetCredentialStatusListRequestPKIMessageResponseDatagenGetCredentialStatusListResponse(java.lang.String relatedEndEntity, PKIMessage request, CredentialStatusList credentialStatusList)Method to generate a GetCredentialStatusListResponsebyte[]genGetIssuerCredentialsRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, Credential originator)Method to generate a GetIssuerCredentialsRequestPKIMessageResponseDatagenGetIssuerCredentialsResponse(java.lang.String relatedEndEntity, PKIMessage request, Credential issuerCredential)Method to generate a GetIssuerCredentialsResponsebyte[]genIsIssuerRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, Credential originator)Method to generate a IsIssuerRequestPKIMessageResponseDatagenIsIssuerResponse(java.lang.String relatedEndEntity, PKIMessage request, boolean isIssuer)Method to generate a IsIssuerResponsebyte[]genIssueCredentialStatusListRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String credentialStatusListType, java.lang.Boolean force, java.util.Date requestedValidFromDate, java.util.Date requestedNotAfterDate, Credential originator)Method to generate a IssueCredentialStatusListRequestPKIMessageResponseDatagenIssueCredentialStatusListResponse(java.lang.String relatedEndEntity, PKIMessage request, CredentialStatusList credentialStatusList)Method to generate a IssueCredentialStatusListResponsePKIMessageResponseDatagenIssueCredentialStatusListResponseWithoutRequest(java.lang.String relatedEndEntity, java.lang.String destination, java.lang.String name, java.lang.String organisation, CredentialStatusList credentialStatusList, Credential originator)Method to generate a IssueCredentialStatusListResponse where there are no request, such as scheduled CRL issuing.byte[]genIssueTokenCredentialsRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, TokenRequest tokenRequest, Credential originator)Method to a IssueTokenCredentialRequest message and populating it with the tokenRequest.PKIMessageResponseDatagenIssueTokenCredentialsResponse(java.lang.String relatedEndEntity, PKIMessage request, java.util.List<Credential> credentials, java.util.List<Credential> revokedCredentials)Method to a IssueTokenCredentialResponse message and populating it with the tokenRequest and the generated responses.PKIMessageResponseDatagenPKIResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, java.lang.String destinationID, Credential originator)Method to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage with a custom defined destinationId.PKIMessageResponseDatagenPKIResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, Credential originator)Method to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage.byte[]genRemoveCredentialRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String serialNumber, Credential originator)Method to generate a RemoveCredentialRequestPKIMessageResponseDatagenRemoveCredentialResponse(java.lang.String relatedEndEntity, PKIMessage request)Method to generate a RemoveCredentialResponsebyte[]genStoreHardTokenDataRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String tokenSerial, java.lang.String relatedCredentialSerialNumber, java.lang.String relatedCredentialIssuerId, byte[] encryptedData, Credential originator)Method to generate a StoreHardTokenDataRequestPKIMessageResponseDatagenStoreHardTokenDataResponse(java.lang.String relatedEndEntity, PKIMessage request)Method to generate a StoreHardTokenDataResponsejava.lang.StringgetDefaultVersion()Method to return the default version.static CredentialgetOriginatorFromRequest(PKIMessage request)java.security.cert.X509CertificategetSigningCertificate(byte[] request)Fetches the signing certificate from the request.voidinit(MessageSecurityProvider securityProvider, java.util.Properties config)Method that initializes the PKIMessage parser with a security provider and properties.byte[]marshallAndSignPKIMessage(PKIMessage pkiMessage)Method that generates the signature and marshalls the message to byte array in UTF-8 format.PKIMessageparseMessage(byte[] messageData)Method to parse the messageData into a PKI Message with validation according to the specification.voidsetDefaultVersion(java.lang.String defaultVersion)Method the set the version to set in generated requests.
-
-
-
Field Detail
-
SETTING_SOURCEID
public static final java.lang.String SETTING_SOURCEID
- See Also:
- Constant Field Values
-
SETTING_SIGN
public static final java.lang.String SETTING_SIGN
- See Also:
- Constant Field Values
-
SETTING_REQUIRESIGNATURE
public static final java.lang.String SETTING_REQUIRESIGNATURE
- See Also:
- Constant Field Values
-
SETTING_MESSAGE_NAME_CATALOGUE_IMPL
public static final java.lang.String SETTING_MESSAGE_NAME_CATALOGUE_IMPL
- See Also:
- Constant Field Values
-
DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL
public static final java.lang.String DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL
-
-
Method Detail
-
init
public void init(MessageSecurityProvider securityProvider, java.util.Properties config) throws MessageException
Description copied from interface:PKIMessageParserMethod that initializes the PKIMessage parser with a security provider and properties.- Specified by:
initin interfacePKIMessageParser- Parameters:
securityProvider- the PKIMessage security provider to use.config- the configuration of the parser.- Throws:
MessageException- if configuration contained bad configuration of security provider.- See Also:
PKIMessageParser.init(org.certificateservices.messages.MessageSecurityProvider, java.util.Properties)
-
parseMessage
public PKIMessage parseMessage(byte[] messageData) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to parse the messageData into a PKI Message with validation according to the specification.- Specified by:
parseMessagein interfacePKIMessageParser- Parameters:
messageData- the message data to parse- Returns:
- a PKIMessage that is valid, never null.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
PKIMessageParser.parseMessage(byte[])
-
genIssueTokenCredentialsRequest
public byte[] genIssueTokenCredentialsRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, TokenRequest tokenRequest, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to a IssueTokenCredentialRequest message and populating it with the tokenRequest.- Specified by:
genIssueTokenCredentialsRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationtokenRequest- the tokenRequest to add to the PKIRequest.originator- the original requester of a message, null if not applicable- Returns:
- generated and signed PKIMessage in byte[] format.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueTokenCredentialsRequest(String, String, TokenRequest)
-
genIssueTokenCredentialsResponse
public PKIMessageResponseData genIssueTokenCredentialsResponse(java.lang.String relatedEndEntity, PKIMessage request, java.util.List<Credential> credentials, java.util.List<Credential> revokedCredentials) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to a IssueTokenCredentialResponse message and populating it with the tokenRequest and the generated responses.- Specified by:
genIssueTokenCredentialsResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withcredentials- the credentials to populate the response with.revokedCredentials- credentials revoked in the operation or null, if no credentials where revoked.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueTokenCredentialsResponse(PKIMessage, List, List)
-
genChangeCredentialStatusRequest
public byte[] genChangeCredentialStatusRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String serialNumber, int newCredentialStatus, java.lang.String reasonInformation, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a ChangeCredentialStatusRequest- Specified by:
genChangeCredentialStatusRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.serialNumber- The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).newCredentialStatus- The new credential status to set.reasonInformation- More detailed information about the revocation statusoriginator- the original requester of a message, null if not applicable- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genChangeCredentialStatusRequest(String, String, String, String, int, String)
-
genChangeCredentialStatusResponse
public PKIMessageResponseData genChangeCredentialStatusResponse(java.lang.String relatedEndEntity, PKIMessage request, java.lang.String issuerId, java.lang.String serialNumber, int credentialStatus, java.lang.String reasonInformation, java.util.Date revocationDate) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a ChangeCredentialStatusResponse- Specified by:
genChangeCredentialStatusResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withissuerId- The unique id of the issuer, usually the subject DN name of the issuer.serialNumber- The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).credentialStatus- the resulted credential status of the requestreasonInformation- More detailed information about the revocation statusrevocationDate- the timestamp when the credential was revoked.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genChangeCredentialStatusResponse(PKIMessage, String, String, int, String, Date)
-
genGetCredentialRequest
public byte[] genGetCredentialRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String credentialSubType, java.lang.String issuerId, java.lang.String serialNumber, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a GetCredentialRequest- Specified by:
genGetCredentialRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationcredentialSubType- the credential sub type of the credential.issuerId- The unique id of the issuer, usually the subject DN name of the issuer.serialNumber- The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialRequest(String, String, String, String, String)
-
genGetCredentialResponse
public PKIMessageResponseData genGetCredentialResponse(java.lang.String relatedEndEntity, PKIMessage request, Credential credential) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a GetCredentialResponse- Specified by:
genGetCredentialResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withcredential- the matching credential of the issued id and serial number- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialResponse(PKIMessage, Credential)
-
genGetCredentialStatusListRequest
public byte[] genGetCredentialStatusListRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.Long serialNumber, java.lang.String credentialStatusListType, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a GetCredentialStatusListRequest- Specified by:
genGetCredentialStatusListRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.serialNumber- The number of the credential status list in the request (Optional)credentialStatusListType- The type of status list to fetchoriginator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialStatusListRequest(String, String, String, Long, String)
-
genGetCredentialStatusListResponse
public PKIMessageResponseData genGetCredentialStatusListResponse(java.lang.String relatedEndEntity, PKIMessage request, CredentialStatusList credentialStatusList) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a GetCredentialStatusListResponse- Specified by:
genGetCredentialStatusListResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withcredentialStatusList- the matching credential status list- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialStatusListResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.CredentialStatusList)
-
genGetIssuerCredentialsRequest
public byte[] genGetIssuerCredentialsRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a GetIssuerCredentialsRequest- Specified by:
genGetIssuerCredentialsRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetIssuerCredentialsRequest(String, String, String)
-
genGetIssuerCredentialsResponse
public PKIMessageResponseData genGetIssuerCredentialsResponse(java.lang.String relatedEndEntity, PKIMessage request, Credential issuerCredential) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a GetIssuerCredentialsResponse- Specified by:
genGetIssuerCredentialsResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withissuerCredential- the issuers credential- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genGetIssuerCredentialsResponse(PKIMessage, Credential)
-
genIsIssuerRequest
public byte[] genIsIssuerRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a IsIssuerRequest- Specified by:
genIsIssuerRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIsIssuerRequest(String, String, String)
-
genIsIssuerResponse
public PKIMessageResponseData genIsIssuerResponse(java.lang.String relatedEndEntity, PKIMessage request, boolean isIssuer) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a IsIssuerResponse- Specified by:
genIsIssuerResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withisIssuer- indicating if current server is issuer or not- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIsIssuerResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, boolean)
-
genIssueCredentialStatusListRequest
public byte[] genIssueCredentialStatusListRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String credentialStatusListType, java.lang.Boolean force, java.util.Date requestedValidFromDate, java.util.Date requestedNotAfterDate, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a IssueCredentialStatusListRequest- Specified by:
genIssueCredentialStatusListRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.credentialStatusListType- The type of status list to fetchoriginator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentExceptionMessageException- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListRequest(String, String, String, String, Boolean, Date, Date)
-
genIssueCredentialStatusListResponse
public PKIMessageResponseData genIssueCredentialStatusListResponse(java.lang.String relatedEndEntity, PKIMessage request, CredentialStatusList credentialStatusList) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a IssueCredentialStatusListResponse- Specified by:
genIssueCredentialStatusListResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response withcredentialStatusList- the new credential status list- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.CredentialStatusList)
-
genIssueCredentialStatusListResponseWithoutRequest
public PKIMessageResponseData genIssueCredentialStatusListResponseWithoutRequest(java.lang.String relatedEndEntity, java.lang.String destination, java.lang.String name, java.lang.String organisation, CredentialStatusList credentialStatusList, Credential originator) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a IssueCredentialStatusListResponse where there are no request, such as scheduled CRL issuing.- Specified by:
genIssueCredentialStatusListResponseWithoutRequestin interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)destination- the destination of the response set in the PKI message.name- the name of the request message this response whould normally reply to.organisation- the organisation set in the response message.credentialStatusList- the new credential status listoriginator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListResponseWithoutRequest(String, String, CredentialStatusList)
-
genRemoveCredentialRequest
public byte[] genRemoveCredentialRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String issuerId, java.lang.String serialNumber, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a RemoveCredentialRequest- Specified by:
genRemoveCredentialRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationissuerId- The unique id of the issuer, usually the subject DN name of the issuer.serialNumber- The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genRemoveCredentialRequest(String, String, String, String)
-
genRemoveCredentialResponse
public PKIMessageResponseData genRemoveCredentialResponse(java.lang.String relatedEndEntity, PKIMessage request) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a RemoveCredentialResponse- Specified by:
genRemoveCredentialResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the request to populate the response with- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genRemoveCredentialResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage)
-
genFetchHardTokenDataRequest
public byte[] genFetchHardTokenDataRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String tokenSerial, java.lang.String relatedCredentialSerialNumber, java.lang.String relatedCredentialIssuerId, Credential adminCredential, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a FetchHardTokenDataRequest- Specified by:
genFetchHardTokenDataRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationtokenSerial- The unique serial number of the hard token within the organisationrelatedCredentialSerialNumber- The serial number of the most related credential in hexadecimal encoding lowercase (for X509 certificates).relatedCredentialIssuerId- The unique id of the issuer of the related credential, usually the subject DN name of the issuer.adminCredential- the credential of the requesting card administrator that need the hard token data. The response data is encrypted with this administrator as recipient.originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genFetchHardTokenDataRequest(String, String, String, String, String, Credential)
-
genFetchHardTokenDataResponse
public PKIMessageResponseData genFetchHardTokenDataResponse(java.lang.String relatedEndEntity, PKIMessage request, java.lang.String tokenSerial, byte[] encryptedData) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a FetchHardTokenDataResponse- Specified by:
genFetchHardTokenDataResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)tokenSerial- The unique serial number of the hard token within the organisation.encryptedData- The token data encrypted with the token administrators credential sent in the request.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genFetchHardTokenDataResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, java.lang.String, byte[])
-
genStoreHardTokenDataRequest
public byte[] genStoreHardTokenDataRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String tokenSerial, java.lang.String relatedCredentialSerialNumber, java.lang.String relatedCredentialIssuerId, byte[] encryptedData, Credential originator) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserMethod to generate a StoreHardTokenDataRequest- Specified by:
genStoreHardTokenDataRequestin interfacePKIMessageParser- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the PKIMessage.organisation- the related organisationtokenSerial- The unique serial number of the hard token within the organisationrelatedCredentialSerialNumber- The serial number of the most related credential in hexadecimal encoding lowercase (for X509 certificates).relatedCredentialIssuerId- The unique id of the issuer of the related credential, usually the subject DN name of the issuer.encryptedData- The token data encrypted with a credential provided out-of-bands by the PKI administrator to protect the data during transport.originator- the original requester of a message, null if not applicable.- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genStoreHardTokenDataRequest(String, String, String, String, String, byte[])
-
genStoreHardTokenDataResponse
public PKIMessageResponseData genStoreHardTokenDataResponse(java.lang.String relatedEndEntity, PKIMessage request) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a StoreHardTokenDataResponse- Specified by:
genStoreHardTokenDataResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)- Returns:
- a generated message.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genStoreHardTokenDataResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage)
-
genPKIResponse
public PKIMessageResponseData genPKIResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, Credential originator) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage.This method is using the request sourceID as destinationID
- Specified by:
genPKIResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the PKI Request data to generate a response for.status- the status to set in the request.failureMessage- the failure message sent in the request.originator- the original requester of a message, null if not applicable.- Returns:
- generated and signed PKIMessage in byte[] format.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genPKIResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.RequestStatus, java.lang.String)
-
genPKIResponse
public PKIMessageResponseData genPKIResponse(java.lang.String relatedEndEntity, byte[] request, RequestStatus status, java.lang.String failureMessage, java.lang.String destinationID, Credential originator) throws java.lang.IllegalArgumentException, MessageException
Description copied from interface:PKIMessageParserMethod to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage with a custom defined destinationId.- Specified by:
genPKIResponsein interfacePKIMessageParser- Parameters:
relatedEndEntity- the name of the related end entity (such as username of the related user)request- the PKI Request data to generate a response for.status- the status to set in the request.failureMessage- the failure message sent in the request.destinationID- the destinationId to use.originator- the original requester of a message, null if not applicable.- Returns:
- generated and signed PKIMessage in byte[] format.
- Throws:
java.lang.IllegalArgumentException- if PKI message contained invalid data not conforming to the standard.MessageException- if internal state occurred when processing the PKIMessage- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#genPKIResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.RequestStatus, java.lang.String, java.lang.String)
-
getSigningCertificate
public java.security.cert.X509Certificate getSigningCertificate(byte[] request) throws java.lang.IllegalArgumentException, MessageExceptionDescription copied from interface:PKIMessageParserFetches the signing certificate from the request.- Specified by:
getSigningCertificatein interfacePKIMessageParser- Parameters:
request- the request to parse the certificate from.- Returns:
- the signer certificate of null if no certificate is required by the parser.
- Throws:
MessageException- if internal error occurred parsing the certificate.java.lang.IllegalArgumentException- See Also:
org.certificateservices.messages.pkimessages.PKIMessageParser#getSigningCertificate(PKIMessage)
-
getDefaultVersion
public java.lang.String getDefaultVersion()
Method to return the default version.- Returns:
- the version used to generate requests by default.
-
setDefaultVersion
public void setDefaultVersion(java.lang.String defaultVersion)
Method the set the version to set in generated requests.- Parameters:
defaultVersion- the version.
-
marshallAndSignPKIMessage
public byte[] marshallAndSignPKIMessage(PKIMessage pkiMessage) throws MessageException
Method that generates the signature and marshalls the message to byte array in UTF-8 format.- Specified by:
marshallAndSignPKIMessagein interfacePKIMessageParser- Parameters:
pkiMessage- the PKIMessage to sign and marshall, never null.- Returns:
- a marshalled and signed message.
- Throws:
MessageException- if problems occurred when processing the message.
-
getOriginatorFromRequest
public static Credential getOriginatorFromRequest(PKIMessage request)
-
-