Class CryptographicServiceMessage
java.lang.Object
org.jpos.security.CryptographicServiceMessage
- All Implemented Interfaces:
Loggeable
Cryptographic Service Message (CSM for short).
A message for transporting keys or
related information used to control a keying relationship.
It is typically the contents of ISOField(123).
For more information refer to ANSI X9.17: Financial Institution Key Mangement
(Wholesale).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when CSM parsing fails. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMessage Class Label for ESM.static final StringMessage Class Label for KSM (Key Service Message).static final StringMessage Class Label for RSI.static final StringMessage Class Label for RSM.static final StringTag name for Clear Text PIN.static final StringTag name for Counter.static final StringTag name for Error Flag.static final StringTag name for Key Data.static final StringTag name for Originator.static final StringTag name for Receiver.static final StringTag name for Server. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Creates a CSM and sets its Message Class -
Method Summary
Modifier and TypeMethodDescriptionvoidadds a field to the CSMvoiddump(PrintStream p, String indent) dumps CSM basic informationgetFieldContent(String tag) Returns the field content of a field with the given tag.getMCL()Returns the message class label.static CryptographicServiceMessageParses a CSM string into aCryptographicServiceMessageobject.voidremoveField(String tag) Remove field from CSMvoidremoveFields(String... tags) Remove fields from CSMvoidSets the message class label.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Loggeable
dumpModifier and TypeMethodDescriptiondefault voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
Field Details
-
MCL_RSI
-
MCL_KSM
-
MCL_RSM
-
MCL_ESM
-
TAG_RCV
-
TAG_ORG
-
TAG_SVR
-
TAG_KD
-
TAG_CTP
-
TAG_CTR
-
TAG_ERF
-
-
Constructor Details
-
CryptographicServiceMessage
public CryptographicServiceMessage()Default constructor. -
CryptographicServiceMessage
Creates a CSM and sets its Message Class- Parameters:
mcl- message class name. e.g. MCL_KSM, MCL_RSM...
-
-
Method Details
-
setMCL
-
getMCL
-
addField
adds a field to the CSM- Parameters:
tag- Field Tagcontent- Field Content, can't be null, use an empty string ("") instead- Throws:
NullPointerException- if tag or content is null
-
removeField
Remove field from CSM- Parameters:
tag- Field Tag- Throws:
NullPointerException- on null tag
-
removeFields
Remove fields from CSM- Parameters:
tags- tag list- Throws:
NullPointerException- on null tag
-
getFieldContent
Returns the field content of a field with the given tag.- Parameters:
tag- the field tag (case-insensitive)- Returns:
- field content, or
nullif tag not found
-
toString
-
dump
dumps CSM basic information -
parse
public static CryptographicServiceMessage parse(String csmString) throws CryptographicServiceMessage.ParsingException Parses a CSM string into aCryptographicServiceMessageobject.- Parameters:
csmString- the CSM string to parse- Returns:
- the parsed CSM object
- Throws:
CryptographicServiceMessage.ParsingException- if the string cannot be parsed
-