/** * Generates an EC keypair. * * @param curveNameOrOid * Object identifier or name of the EC curve. Must not be {@code null}. * @param control * Control of the key generation process. Must not be {@code null}. * @return the identifier of the identity within the PKCS#P11 token. * @throws P11TokenException * if PKCS#11 token exception occurs. */ // CHECKSTYLE:SKIP public P11IdentityId generateECKeypair(String curveNameOrOid, P11NewKeyControl control) throws P11TokenException { Args.notBlank(curveNameOrOid, "curveNameOrOid"); assertCanGenKeypair("generateECKeypair", PKCS11Constants.CKM_EC_KEY_PAIR_GEN, control); ASN1ObjectIdentifier curveId = AlgorithmUtil.getCurveOidForCurveNameOrOid(curveNameOrOid); if (curveId == null) { throw new IllegalArgumentException("unknown curve " + curveNameOrOid); } P11Identity identity = generateECKeypair0(curveId, control); addIdentity(identity); P11IdentityId id = identity.getId(); LOG.info("generated EC keypair {}", id); return id; }
/** * Generates an EC keypair. * * @param curveNameOrOid * Object identifier or name of the EC curve. Must not be {@code null}. * @param control * Control of the key generation process. Must not be {@code null}. * @return the identifier of the identity within the PKCS#P11 token. * @throws P11TokenException * if PKCS#11 token exception occurs. */ // CHECKSTYLE:SKIP public P11IdentityId generateECKeypair(String curveNameOrOid, P11NewKeyControl control) throws P11TokenException { ParamUtil.requireNonBlank("curveNameOrOid", curveNameOrOid); assertCanGenKeypair("generateECKeypair", PKCS11Constants.CKM_EC_KEY_PAIR_GEN, control); ASN1ObjectIdentifier curveId = AlgorithmUtil.getCurveOidForCurveNameOrOid(curveNameOrOid); if (curveId == null) { throw new IllegalArgumentException("unknown curve " + curveNameOrOid); } P11Identity identity = generateECKeypair0(curveId, control); addIdentity(identity); P11IdentityId id = identity.getId(); LOG.info("generated EC keypair {}", id); return id; }