diff --git a/pkcs11/_pkcs11.pyx b/pkcs11/_pkcs11.pyx index 5508d08..5476ae9 100644 --- a/pkcs11/_pkcs11.pyx +++ b/pkcs11/_pkcs11.pyx @@ -658,7 +658,7 @@ class Session(types.Session): Attribute.DERIVE: MechanismFlag.DERIVE & capabilities, } - if key_type is KeyType.AES: + if key_type not in (KeyType.DES2, KeyType.DES3, KeyType.GOST28147, KeyType.SEED): if key_length is None: raise ArgumentsBad("Must provide `key_length'") diff --git a/pkcs11/defaults.py b/pkcs11/defaults.py index 66f821f..31ebec1 100644 --- a/pkcs11/defaults.py +++ b/pkcs11/defaults.py @@ -26,6 +26,7 @@ KeyType.RSA: Mechanism.RSA_PKCS_KEY_PAIR_GEN, KeyType.X9_42_DH: Mechanism.X9_42_DH_KEY_PAIR_GEN, KeyType.EC_EDWARDS: Mechanism.EC_EDWARDS_KEY_PAIR_GEN, + KeyType.GENERIC_SECRET: Mechanism.GENERIC_SECRET_KEY_GEN, } """ Default mechanisms for generating keys.