diff --git a/pkcs11/_pkcs11.pyx b/pkcs11/_pkcs11.pyx index c0e5f44..d80fe15 100644 --- a/pkcs11/_pkcs11.pyx +++ b/pkcs11/_pkcs11.pyx @@ -491,7 +491,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 cb823d3..e6b2a1c 100644 --- a/pkcs11/defaults.py +++ b/pkcs11/defaults.py @@ -27,6 +27,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.