public KeyPair GenerateKeyPair(Mechanism mech, P11Object pubTemplate, P11Object privTemplate) { KeyPairHandler hkp = this.Module.P11Module.GenerateKeyPair( hSession, mech.CK_MECHANISM, getAssignedAttributes(pubTemplate), getAssignedAttributes(privTemplate) ); return(new KeyPair( (PublicKey)PublicKey.GetInstance(this, hkp.hPublicKey), (PrivateKey)PrivateKey.GetInstance(this, hkp.hPrivateKey) )); }