Package ch.imvs.sdes4j.srtp
Class SrtpSDesFactory
- java.lang.Object
-
- ch.imvs.sdes4j.srtp.SrtpSDesFactory
-
- All Implemented Interfaces:
SDesFactory
public class SrtpSDesFactory extends java.lang.Object implements SDesFactory
Factory for the SRTP grammar of RFC4568.- Author:
- Ingo Bauersachs
-
-
Constructor Summary
Constructors Constructor Description SrtpSDesFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SrtpCryptoAttribute
createCryptoAttribute()
Creates an empty crypto attribute for the grammar implementing this interface.SrtpCryptoAttribute
createCryptoAttribute(int tag, java.lang.String keyAlg)
Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.SrtpCryptoAttribute
createCryptoAttribute(int tag, java.lang.String keyAlg, SrtpSessionParam[] params)
Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.SrtpCryptoSuite
createCryptoSuite(java.lang.String suite)
Creates a crypto suite instance for the grammar implementing this interface.SrtpKeyParam
createKeyParam(java.lang.String keyParam)
Creates a key parameter instance for the grammar implementing this interface.SrtpKeyParam[]
createKeyParamArray(int size)
Utility method to create a typed array ofKeyParameter
s.SrtpSessionParam
createSessionParam(java.lang.String sessionParam)
Creates a session parameter instance for the grammar implementing this interface.SrtpSessionParam[]
createSessionParamArray(int size)
Utility method to create a typed array ofSessionParam
s.void
setRandomGenerator(java.util.Random r)
Sets the random number generator to be used for generating the SDES keys.
-
-
-
Method Detail
-
createCryptoAttribute
public SrtpCryptoAttribute createCryptoAttribute(int tag, java.lang.String keyAlg)
Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.If no random generator is set with
setRandomGenerator(Random)
then the SHA1PRNG, or if not available, the system's defaultSecureRandom
will be used.- Parameters:
tag
- decimal number used as an identifier for a particular crypto attributekeyAlg
- identifier that describes the encryption and authentication algorithms- Returns:
- SRTP crypto attribute without session parameters.
-
createCryptoAttribute
public SrtpCryptoAttribute createCryptoAttribute(int tag, java.lang.String keyAlg, SrtpSessionParam[] params)
Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.- Parameters:
tag
- decimal number used as an identifier for a particular crypto attributekeyAlg
- identifier that describes the encryption and authentication algorithmsparams
- Session parameters for the crypto attribute- Returns:
- SRTP crypto attribute without session parameters.
-
setRandomGenerator
public void setRandomGenerator(java.util.Random r)
Description copied from interface:SDesFactory
Sets the random number generator to be used for generating the SDES keys.- Specified by:
setRandomGenerator
in interfaceSDesFactory
- Parameters:
r
- The random number generator.
-
createCryptoAttribute
public SrtpCryptoAttribute createCryptoAttribute()
Description copied from interface:SDesFactory
Creates an empty crypto attribute for the grammar implementing this interface.- Specified by:
createCryptoAttribute
in interfaceSDesFactory
- Returns:
- Empty crypto attribute to be filled by a parser.
-
createCryptoSuite
public SrtpCryptoSuite createCryptoSuite(java.lang.String suite)
Description copied from interface:SDesFactory
Creates a crypto suite instance for the grammar implementing this interface.- Specified by:
createCryptoSuite
in interfaceSDesFactory
- Parameters:
suite
- The suite name that defines the cryptographic parameters.- Returns:
- A crypto suite instance based on the supplied suite name.
-
createKeyParam
public SrtpKeyParam createKeyParam(java.lang.String keyParam)
Description copied from interface:SDesFactory
Creates a key parameter instance for the grammar implementing this interface.- Specified by:
createKeyParam
in interfaceSDesFactory
- Parameters:
keyParam
- The textual representation of the key parameter field.- Returns:
- The parsed key parameter.
-
createKeyParamArray
public SrtpKeyParam[] createKeyParamArray(int size)
Description copied from interface:SDesFactory
Utility method to create a typed array ofKeyParameter
s.- Specified by:
createKeyParamArray
in interfaceSDesFactory
- Parameters:
size
- The size of the array to create.- Returns:
- KeyParam array of the specified size.
-
createSessionParam
public SrtpSessionParam createSessionParam(java.lang.String sessionParam)
Description copied from interface:SDesFactory
Creates a session parameter instance for the grammar implementing this interface.- Specified by:
createSessionParam
in interfaceSDesFactory
- Parameters:
sessionParam
- The textual representation of the session parameter.- Returns:
- The parsed session parameter.
-
createSessionParamArray
public SrtpSessionParam[] createSessionParamArray(int size)
Description copied from interface:SDesFactory
Utility method to create a typed array ofSessionParam
s.- Specified by:
createSessionParamArray
in interfaceSDesFactory
- Parameters:
size
- The size of the array to create.- Returns:
- SessionParam array of the specified size.
-
-