dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives
Cryptographic primitive resources for JCE bridge.
Warning
No guarantee is provided on the modules and APIs within this namespace staying consistent. Directly reference at your own risk.
Functions
|
Load an RSA key object from the provided raw key bytes. |
Classes
|
Padding types that require a block size input. |
|
JavaEncryptionAlgorithm for asymmetric algorithms. |
|
Bridge the gap from the Java encryption algorithm names and Python resources. |
|
Bridge the gap from the Java encryption mode names and Python resources. |
Bridge the gap from the Java padding names and Python resources. |
|
|
JavaEncryptionAlgorithm for symmetric algorithms. |
|
OAEP padding types. |
|
Padding types that do not require any preparation. |
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaPadding[source]
Bases:
object
Bridge the gap from the Java padding names and Python resources. https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.SimplePadding(java_name: str, padding: Callable)[source]
Bases:
dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaPadding
Padding types that do not require any preparation.
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.BlockSizePadding(java_name: str, padding: Callable)[source]
Bases:
dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaPadding
Padding types that require a block size input.
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.OaepPadding(java_name: str, padding: Callable, digest: Callable, mgf: Callable, mgf_digest: Callable)[source]
Bases:
dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaPadding
OAEP padding types. These require more complex setup.
Warning
By default, Java incorrectly implements RSA OAEP for all hash functions besides SHA1. The same hashing algorithm should be used by both OAEP and the MGF, but by default Java always uses SHA1 for the MGF.
Because we need to match this behavior, all
OaepPadding
instances should be created with MGF1-SHA1.
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaMode(java_name: str, mode: Callable)[source]
Bases:
object
Bridge the gap from the Java encryption mode names and Python resources. https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaEncryptionAlgorithm(java_name: str, cipher: Callable)[source]
Bases:
object
Bridge the gap from the Java encryption algorithm names and Python resources. https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaSymmetricEncryptionAlgorithm(java_name: str, cipher: Callable)[source]
Bases:
dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaEncryptionAlgorithm
JavaEncryptionAlgorithm for symmetric algorithms. https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher
- load_key(key, key_type, key_encoding)[source]
Load a key from bytes.
- Parameters
key (bytes) – Key bytes
key_type (EncryptionKeyType) – Type of key
key_encoding (KeyEncodingType) – Encoding used to serialize key
- Returns
Loaded key
- encrypt(key, data, mode, padding)[source]
Encrypt data using the supplied values.
- Parameters
key (bytes) – Loaded encryption key
data (bytes) – Data to encrypt
mode (JavaMode) – Encryption mode to use
padding (JavaPadding) – Padding mode to use
- Returns
IV prepended to encrypted data
- Return type
- class dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaAsymmetricEncryptionAlgorithm(java_name: str, cipher: Callable)[source]
Bases:
dynamodb_encryption_sdk.internal.crypto.jce_bridge.primitives.JavaEncryptionAlgorithm
JavaEncryptionAlgorithm for asymmetric algorithms.
https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher
- load_key(key, key_type, key_encoding)[source]
Load a key from bytes.
- Parameters
key (bytes) – Key bytes
key_type (EncryptionKeyType) – Type of key
key_encoding (KeyEncodingType) – Encoding used to serialize key
- Returns
Loaded key
- encrypt(key, data, mode, padding)[source]
Encrypt data using the supplied values.
- Parameters
key (bytes) – Loaded encryption key
data (bytes) – Data to encrypt
mode (JavaMode) – Encryption mode to use (not used by
JavaAsymmetricEncryptionAlgorithm
)padding (JavaPadding) – Padding mode to use
- Returns
Encrypted data
- Return type
- decrypt(key, data, mode, padding)[source]
Decrypt data using the supplied values.
- Parameters
key (bytes) – Loaded decryption key
data (bytes) – IV prepended to encrypted data
mode (JavaMode) – Decryption mode to use (not used by
JavaAsymmetricEncryptionAlgorithm
)padding (JavaPadding) – Padding mode to use
- Returns
Decrypted data
- Return type