Package ch.imvs.sdes4j
Class CryptoAttribute
- java.lang.Object
-
- ch.imvs.sdes4j.CryptoAttribute
-
- Direct Known Subclasses:
SrtpCryptoAttribute
public class CryptoAttribute extends java.lang.ObjectPrimary class for a RFC4568 Crypto Attribute.- Author:
- Ingo Bauersachs
-
-
Field Summary
Fields Modifier and Type Field Description protected CryptoSuitecryptoSuiteprotected KeyParam[]keyParamsprotected SessionParam[]sessionParamsprotected inttag
-
Constructor Summary
Constructors Modifier Constructor Description protectedCryptoAttribute()CryptoAttribute(int tag, CryptoSuite cryptoSuite, KeyParam[] keyParams, SessionParam[] sessionParams)Creates a crypto attribute from already instantiated objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CryptoAttributecreate(java.lang.String attribute, SDesFactory f)Creates an instance of a CryptoAttribute from an SDes string in the format of tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)static CryptoAttributecreate(java.lang.String tag, java.lang.String cryptoSuite, java.lang.String keyParams, java.lang.String sessionParams, SDesFactory f)Creates an instance of a CryptoAttribute from a SDes attributes (tag, crypto suite, key params and session params).java.lang.Stringencode()Encodes this crypto attribute as a string according to the ABNF rule tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)booleanequals(java.lang.Object obj)CryptoSuitegetCryptoSuite()Gets the identifier that describes the encryption and authentication algorithms (e.g., AES_CM_128_HMAC_SHA1_80) for the transport in question.KeyParam[]getKeyParams()Gets one or more sets of keying material for the crypto-suite in question.java.lang.StringgetKeyParamsString()Returns a string representation the key parameters according to the ABNF rule key-params.SessionParam[]getSessionParams()Gets the additional key parameters for this particular crypto attribute.java.lang.StringgetSessionParamsString()Returns a string representation of the session parameters according to the ABNF rule session-param.intgetTag()Gets the identifier for this particular crypto attribute.inthashCode()
-
-
-
Field Detail
-
tag
protected int tag
-
cryptoSuite
protected CryptoSuite cryptoSuite
-
keyParams
protected KeyParam[] keyParams
-
sessionParams
protected SessionParam[] sessionParams
-
-
Constructor Detail
-
CryptoAttribute
protected CryptoAttribute()
-
CryptoAttribute
public CryptoAttribute(int tag, CryptoSuite cryptoSuite, KeyParam[] keyParams, SessionParam[] sessionParams)Creates a crypto attribute from already instantiated objects.- Parameters:
tag- identifier for this particular crypto attributecryptoSuite- identifier that describes the encryption and authentication algorithmskeyParams- one or more sets of keying materialsessionParams- the additional key parameters
-
-
Method Detail
-
create
public static CryptoAttribute create(java.lang.String attribute, SDesFactory f)
Creates an instance of a CryptoAttribute from an SDes string in the format of tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)- Parameters:
attribute- the encoded SDes attributef- factory that creates the instances for each part of the attribute- Returns:
- a parsed crypto attribute
-
create
public static CryptoAttribute create(java.lang.String tag, java.lang.String cryptoSuite, java.lang.String keyParams, java.lang.String sessionParams, SDesFactory f)
Creates an instance of a CryptoAttribute from a SDes attributes (tag, crypto suite, key params and session params).- Parameters:
tag- unparsed tag as a string.cryptoSuite- the crypto suite as an unparsed string.keyParams- An unparsed string representation of the key param list (each key must be separated by a ";").sessionParams- An unparsed string representation of the session param list (each key must be separated by a " ").f- factory that creates the instances for each part of the attribute- Returns:
- a parsed crypto attribute
-
getTag
public int getTag()
Gets the identifier for this particular crypto attribute.- Returns:
- the tag
-
getCryptoSuite
public CryptoSuite getCryptoSuite()
Gets the identifier that describes the encryption and authentication algorithms (e.g., AES_CM_128_HMAC_SHA1_80) for the transport in question.- Returns:
- the cryptoSuite
-
getKeyParams
public KeyParam[] getKeyParams()
Gets one or more sets of keying material for the crypto-suite in question.- Returns:
- the keyParams
-
getSessionParams
public SessionParam[] getSessionParams()
Gets the additional key parameters for this particular crypto attribute.- Returns:
- the sessionParams
-
encode
public java.lang.String encode()
Encodes this crypto attribute as a string according to the ABNF rule tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)- Returns:
- Complete crypto attribute for use in the SDP.
-
getKeyParamsString
public java.lang.String getKeyParamsString()
Returns a string representation the key parameters according to the ABNF rule key-params.- Returns:
- String representation of the list of key params separated by ";".
-
getSessionParamsString
public java.lang.String getSessionParamsString()
Returns a string representation of the session parameters according to the ABNF rule session-param.- Returns:
- Returns a string representation of the list of session params separated by " ", or null if there are no session params.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-