Class HardTokenDataParser
- java.lang.Object
-
- org.certificateservices.messages.hardtoken.HardTokenDataParser
-
public class HardTokenDataParser extends java.lang.ObjectClass to generate and parse Hard Token Data Structures. It has also methods to create encrypted binary data defined in the credential managment protocol 2.0 specification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classHardTokenDataParser.HardTokenParserLSResourceResolver
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_VERSIONstatic java.lang.StringNAMESPACE
-
Constructor Summary
Constructors Constructor Description HardTokenDataParser(MessageSecurityProvider securityProvider)Constructor for Hard Token Data Parser, this is the default method to create a parser, it should not be fetched by the PayloadParserRegistry since this is not a CSMessagePayload.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HardTokenDatadecryptAndParse(byte[] encryptedData)Method to decrypt and unmarshall a hard token data.byte[]encryptAndMarshall(HardTokenData hardTokenData, java.util.List<java.security.cert.X509Certificate> receipients)Method to serialize and encrypt a hard token data to a given reciepient.HardTokenDatagenHardTokenData(java.lang.String tokenType, java.lang.String tokenClass, java.lang.String serialNumber, boolean supportsRemoteUnblock, java.util.Date createTime, java.util.Date modifyTime, java.util.List<PINData> pins)Method to create a basic Hard Token Data without any key recovery functionality.byte[]marshall(HardTokenData hardTokenData)Method to serialize a hard token data to a byte array.HardTokenDataparse(byte[] data)Method to parse a unencrypted hard token data.
-
-
-
Constructor Detail
-
HardTokenDataParser
public HardTokenDataParser(MessageSecurityProvider securityProvider) throws MessageProcessingException
Constructor for Hard Token Data Parser, this is the default method to create a parser, it should not be fetched by the PayloadParserRegistry since this is not a CSMessagePayload.- Parameters:
securityProvider- the security provider to use for encrypting and decrypting messages.- Throws:
MessageProcessingException- if internal problems occurred initializing the parser.
-
-
Method Detail
-
parse
public HardTokenData parse(byte[] data) throws MessageContentException, MessageProcessingException
Method to parse a unencrypted hard token data.- Parameters:
data- a serialized hard token data XML structure.- Returns:
- a unmarshalled HardTokenData.
- Throws:
MessageContentException- if xml data was invalidMessageProcessingException- if internal problems occurred unmarshalling the data.
-
decryptAndParse
public HardTokenData decryptAndParse(byte[] encryptedData) throws MessageContentException, MessageProcessingException, NoDecryptionKeyFoundException
Method to decrypt and unmarshall a hard token data.The encrypted data should be a XML Encryption (http://www.w3.org/2001/04/xmlenc#) EncryptedData element..
- Parameters:
encryptedData- the encrypted XML data.- Returns:
- an unmarshalled HardTokenData
- Throws:
MessageContentException- if xml data was invalid.MessageProcessingException- if internal problems occurred unmarshalling or decrypting the data.NoDecryptionKeyFoundException- if decryption key couldn't be found in security provider.
-
genHardTokenData
public HardTokenData genHardTokenData(java.lang.String tokenType, java.lang.String tokenClass, java.lang.String serialNumber, boolean supportsRemoteUnblock, java.util.Date createTime, java.util.Date modifyTime, java.util.List<PINData> pins) throws MessageProcessingException
Method to create a basic Hard Token Data without any key recovery functionality.All parameters must be set.
- Parameters:
tokenType- the token type of the tokentokenClass- the token class, i.e ordinary. temporary etc.serialNumber- the serial number of the hard tokensupportsRemoteUnblock- if token supports remote unblock.createTime- the create time of the hard token datamodifyTime- the modify time of the hard token datapins- a List of PinDatas to set, min size 1- Returns:
- a newly generated hard token data.
- Throws:
MessageProcessingException- if date convertion fails.
-
marshall
public byte[] marshall(HardTokenData hardTokenData) throws MessageContentException, MessageProcessingException
Method to serialize a hard token data to a byte array.- Parameters:
hardTokenData- the hard token data to serialize- Returns:
- a serialized version of the hard token data.
- Throws:
MessageContentException- if hard token data contained invalid content.MessageProcessingException- if internal problems occurred marshalling the data.
-
encryptAndMarshall
public byte[] encryptAndMarshall(HardTokenData hardTokenData, java.util.List<java.security.cert.X509Certificate> receipients) throws MessageContentException, MessageProcessingException
Method to serialize and encrypt a hard token data to a given reciepient.The data will first be transformed into a encrypted data.
- Parameters:
hardTokenData- the hard token data to serialize- Returns:
- a serialized version of the hard token data.
- Throws:
MessageContentException- if hard token data contained invalid content.MessageProcessingException- if internal problems occurred marshalling the data.
-
-