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 SrtpCryptoAttributecreateCryptoAttribute()Creates an empty crypto attribute for the grammar implementing this interface.SrtpCryptoAttributecreateCryptoAttribute(int tag, java.lang.String keyAlg)Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.SrtpCryptoAttributecreateCryptoAttribute(int tag, java.lang.String keyAlg, SrtpSessionParam[] params)Creates an SRTP crypto attribute with the specified parameters, for use in an SDP.SrtpCryptoSuitecreateCryptoSuite(java.lang.String suite)Creates a crypto suite instance for the grammar implementing this interface.SrtpKeyParamcreateKeyParam(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 ofKeyParameters.SrtpSessionParamcreateSessionParam(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 ofSessionParams.voidsetRandomGenerator(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 defaultSecureRandomwill 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:SDesFactorySets the random number generator to be used for generating the SDES keys.- Specified by:
setRandomGeneratorin interfaceSDesFactory- Parameters:
r- The random number generator.
-
createCryptoAttribute
public SrtpCryptoAttribute createCryptoAttribute()
Description copied from interface:SDesFactoryCreates an empty crypto attribute for the grammar implementing this interface.- Specified by:
createCryptoAttributein interfaceSDesFactory- Returns:
- Empty crypto attribute to be filled by a parser.
-
createCryptoSuite
public SrtpCryptoSuite createCryptoSuite(java.lang.String suite)
Description copied from interface:SDesFactoryCreates a crypto suite instance for the grammar implementing this interface.- Specified by:
createCryptoSuitein 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:SDesFactoryCreates a key parameter instance for the grammar implementing this interface.- Specified by:
createKeyParamin 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:SDesFactoryUtility method to create a typed array ofKeyParameters.- Specified by:
createKeyParamArrayin 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:SDesFactoryCreates a session parameter instance for the grammar implementing this interface.- Specified by:
createSessionParamin 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:SDesFactoryUtility method to create a typed array ofSessionParams.- Specified by:
createSessionParamArrayin interfaceSDesFactory- Parameters:
size- The size of the array to create.- Returns:
- SessionParam array of the specified size.
-
-