Search in sources :

Example 1 with RSAPrivateKey

use of iaik.pkcs.pkcs11.objects.RSAPrivateKey in project xipki by xipki.

the class IaikP11Slot method generateRSAKeypair0.

@Override
protected P11Identity generateRSAKeypair0(int keysize, BigInteger publicExponent, String label, P11NewKeyControl control) throws P11TokenException {
    long mech = PKCS11Constants.CKM_RSA_PKCS_KEY_PAIR_GEN;
    assertMechanismSupported(mech);
    RSAPrivateKey privateKey = new RSAPrivateKey();
    RSAPublicKey publicKey = new RSAPublicKey();
    setKeyAttributes(label, PKCS11Constants.CKK_RSA, control, publicKey, privateKey);
    publicKey.getModulusBits().setLongValue((long) keysize);
    if (publicExponent != null) {
        publicKey.getPublicExponent().setByteArrayValue(publicExponent.toByteArray());
    }
    return generateKeyPair(mech, privateKey, publicKey);
}
Also used : RSAPublicKey(iaik.pkcs.pkcs11.objects.RSAPublicKey) RSAPrivateKey(iaik.pkcs.pkcs11.objects.RSAPrivateKey)

Aggregations

RSAPrivateKey (iaik.pkcs.pkcs11.objects.RSAPrivateKey)1 RSAPublicKey (iaik.pkcs.pkcs11.objects.RSAPublicKey)1