futurefinity.security – FutureFinity Cryptography Implementation

class futurefinity.security.AESGCMSecurityContext(security_secret: str)[source]

Security Context uses AES GCM.

This is the default security context of FutureFinity.

It Uses cryptography library which can be installed via pip to encrypt/decrypt the content and ensure the intrgrity of the content by AES GCM.

If cryptography is not installed, it will raise an FutureFinityError.

Parameters:security_secret – is a string or bytes for the generate signature. This can be generated by futurefinity.security.get_random_str.
class futurefinity.security.HMACSecurityContext(security_secret: str)[source]

Security Context uses HMAC.

It Uses Built-in hmac library to create a signature for the given content.

It doesn’t encrypt the content, but only ensures the integrity of the content. No one can forge the content, or replace the content without the security secret.

Parameters:security_secret – is a string or bytes for the generate signature. This can be generated by futurefinity.security.get_random_str.
futurefinity.security.get_random_str(length: int) → str[source]

Generate a random string with specified length by random.SystemRandom.

If random.SystemRandom is not presented, it will raise an NotImplementedError.