Class CryptoAttribute

  • Direct Known Subclasses:
    SrtpCryptoAttribute

    public class CryptoAttribute
    extends java.lang.Object
    Primary class for a RFC4568 Crypto Attribute.
    Author:
    Ingo Bauersachs
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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)
      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).
      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)
      boolean equals​(java.lang.Object obj)  
      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.
      KeyParam[] getKeyParams()
      Gets one or more sets of keying material for the crypto-suite in question.
      java.lang.String getKeyParamsString()
      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.String getSessionParamsString()
      Returns a string representation of the session parameters according to the ABNF rule session-param.
      int getTag()
      Gets the identifier for this particular crypto attribute.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tag

        protected int tag
      • keyParams

        protected KeyParam[] keyParams
    • 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 attribute
        cryptoSuite - identifier that describes the encryption and authentication algorithms
        keyParams - one or more sets of keying material
        sessionParams - 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 attribute
        f - 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object