Package org.jpos.security
Class CryptographicServiceMessage
- java.lang.Object
-
- org.jpos.security.CryptographicServiceMessage
-
- All Implemented Interfaces:
Loggeable
public class CryptographicServiceMessage extends java.lang.Object implements 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 Classes Modifier and Type Class Description static class
CryptographicServiceMessage.ParsingException
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MCL_ESM
static java.lang.String
MCL_KSM
static java.lang.String
MCL_RSI
static java.lang.String
MCL_RSM
static java.lang.String
TAG_CTP
static java.lang.String
TAG_CTR
static java.lang.String
TAG_ERF
static java.lang.String
TAG_KD
static java.lang.String
TAG_ORG
static java.lang.String
TAG_RCV
static java.lang.String
TAG_SVR
-
Constructor Summary
Constructors Constructor Description CryptographicServiceMessage()
CryptographicServiceMessage(java.lang.String mcl)
Creates a CSM and sets its Message Class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(java.lang.String tag, java.lang.String content)
adds a field to the CSMvoid
dump(java.io.PrintStream p, java.lang.String indent)
dumps CSM basic informationjava.lang.String
getFieldContent(java.lang.String tag)
Returns the field content of a field with the given tagjava.lang.String
getMCL()
static CryptographicServiceMessage
parse(java.lang.String csmString)
Parses a csm stringvoid
removeField(java.lang.String tag)
Remove field from CSMvoid
removeFields(java.lang.String... tags)
Remove fields from CSMvoid
setMCL(java.lang.String mcl)
java.lang.String
toString()
Formats the CSM as a string, suitable for transfer.
-
-
-
Field Detail
-
MCL_RSI
public static final java.lang.String MCL_RSI
- See Also:
- Constant Field Values
-
MCL_KSM
public static final java.lang.String MCL_KSM
- See Also:
- Constant Field Values
-
MCL_RSM
public static final java.lang.String MCL_RSM
- See Also:
- Constant Field Values
-
MCL_ESM
public static final java.lang.String MCL_ESM
- See Also:
- Constant Field Values
-
TAG_RCV
public static final java.lang.String TAG_RCV
- See Also:
- Constant Field Values
-
TAG_ORG
public static final java.lang.String TAG_ORG
- See Also:
- Constant Field Values
-
TAG_SVR
public static final java.lang.String TAG_SVR
- See Also:
- Constant Field Values
-
TAG_KD
public static final java.lang.String TAG_KD
- See Also:
- Constant Field Values
-
TAG_CTP
public static final java.lang.String TAG_CTP
- See Also:
- Constant Field Values
-
TAG_CTR
public static final java.lang.String TAG_CTR
- See Also:
- Constant Field Values
-
TAG_ERF
public static final java.lang.String TAG_ERF
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CryptographicServiceMessage
public CryptographicServiceMessage()
-
CryptographicServiceMessage
public CryptographicServiceMessage(java.lang.String mcl)
Creates a CSM and sets its Message Class- Parameters:
mcl
- message class name. e.g. MCL_KSM, MCL_RSM...
-
-
Method Detail
-
setMCL
public void setMCL(java.lang.String mcl)
-
getMCL
public java.lang.String getMCL()
-
addField
public void addField(java.lang.String tag, java.lang.String content)
adds a field to the CSM- Parameters:
tag
- Field Tagcontent
- Field Content, can't be null, use an empty string ("") instead- Throws:
java.lang.NullPointerException
- if tag or content is null
-
removeField
public void removeField(java.lang.String tag)
Remove field from CSM- Parameters:
tag
- Field Tag- Throws:
java.lang.NullPointerException
- on null tag
-
removeFields
public void removeFields(java.lang.String... tags)
Remove fields from CSM- Parameters:
tags
- tag list- Throws:
java.lang.NullPointerException
- on null tag
-
getFieldContent
public java.lang.String getFieldContent(java.lang.String tag)
Returns the field content of a field with the given tag- Parameters:
tag
-- Returns:
- field Field Content, or null if tag not found
-
toString
public java.lang.String toString()
Formats the CSM as a string, suitable for transfer. This is the inverse of parse- Overrides:
toString
in classjava.lang.Object
- Returns:
- the CSM in string format
-
dump
public void dump(java.io.PrintStream p, java.lang.String indent)
dumps CSM basic information
-
parse
public static CryptographicServiceMessage parse(java.lang.String csmString) throws CryptographicServiceMessage.ParsingException
Parses a csm string- Parameters:
csmString
-- Returns:
- CSM object
- Throws:
CryptographicServiceMessage.ParsingException
-
-