SECKEYPrivateKey *privk; PK11SlotInfo *slot = PK11_GetBestSlot(CKM_RSA_PKCS_KEY_PAIR_GEN,cx); PK11RSAGenParams param;  param.keySizeInBits = keySizeInBits; param.pe = 65537L;  privk = PK11_GenerateKeyPair(slot,CKM_RSA_PKCS_KEY_PAIR_GEN,&param,pubk, PR_FALSE, PR_TRUE, cx); PK11_FreeSlot(slot); return(privk);
pubk->u.rsa.modulus.type = siUnsignedInteger; pubk->u.rsa.publicExponent.type = siUnsignedInteger;
SEC_ASN1_CHOOSER_IMPLEMENT(SECKEY_DSAPublicKeyTemplate)SEC_ASN1_CHOOSER_IMPLEMENT(SECKEY_RSAPublicKeyTemplate)SEC_ASN1_CHOOSER_IMPLEMENT(CERT_SubjectPublicKeyInfoTemplate)/* Create an RSA key pair is any slot able to do so.** The created keys are "session" (temporary), not "token" (permanent), ** and they are "sensitive", which makes them costly to move to another token.*/SECKEYPrivateKey *SECKEY_CreateRSAPrivateKey(int keySizeInBits,SECKEYPublicKey **pubk, void *cx){    SECKEYPrivateKey *privk;    PK11SlotInfo *slot = PK11_GetBestSlot(CKM_RSA_PKCS_KEY_PAIR_GEN,cx);    PK11RSAGenParams param;    param.keySizeInBits = keySizeInBits;    param.pe = 65537L;        privk = PK11_GenerateKeyPair(slot,CKM_RSA_PKCS_KEY_PAIR_GEN,&param,pubk,					PR_FALSE, PR_TRUE, cx);    PK11_FreeSlot(slot);    return(privk);}