tlslite.utils.cipherfactory module

Factory functions for symmetric cryptography.

tlslite.utils.cipherfactory.createAES(key, IV, implList=None)[source]

Create a new AES object.

Parameters:
  • key (str) – A 16, 24, or 32 byte string.

  • IV (str) – A 16 byte string

Return type:

tlslite.utils.AES

Returns:

An AES object.

tlslite.utils.cipherfactory.createAESCCM(key, implList=None)[source]

Create a new AESCCM object.

Parameters:

key (bytearray) – A 16 or 32 byte byte array to serve as key.

Return type:

tlslite.utils.AESCCM

Returns:

An AESCCM object.

tlslite.utils.cipherfactory.createAESCCM_8(key, implList=None)[source]

Create a new AESCCM object with truncated tag.

Parameters:

key (bytearray) – A 16 or 32 byte byte array to serve as key.

Return type:

tlslite.utils.AESCCM

Returns:

An AESCCM object.

tlslite.utils.cipherfactory.createAESCTR(key, IV, implList=None)[source]

Create a new AESCTR object.

Parameters:
  • key (str) – A 16, 24, or 32 byte string.

  • IV (str) – A 8 or 12 byte string

Return type:

tlslite.utils.AES

Returns:

An AES object.

tlslite.utils.cipherfactory.createAESGCM(key, implList=None)[source]

Create a new AESGCM object.

Parameters:

key (bytearray) – A 16 or 32 byte byte array.

Return type:

tlslite.utils.AESGCM

Returns:

An AESGCM object.

tlslite.utils.cipherfactory.createCHACHA20(key, implList=None)[source]

Create a new CHACHA20_POLY1305 object.

Parameters:

key (bytearray) – a 32 byte array to serve as key

Return type:

tlslite.utils.CHACHA20_POLY1305

Returns:

A ChaCha20/Poly1305 object

tlslite.utils.cipherfactory.createRC4(key, IV, implList=None)[source]

Create a new RC4 object.

Parameters:
  • key (str) – A 16 to 32 byte string.

  • IV (object) – Ignored, whatever it is.

Return type:

tlslite.utils.RC4

Returns:

An RC4 object.

tlslite.utils.cipherfactory.createTripleDES(key, IV, implList=None)[source]

Create a new 3DES object.

Parameters:
  • key (str) – A 24 byte string.

  • IV (str) – An 8 byte string

Return type:

tlslite.utils.TripleDES

Returns:

A 3DES object.

tlslite.utils.cipherfactory.tripleDESPresent = True

Inform if the 3DES algorithm is supported.