Search in sources :

Example 21 with P11Slot

use of org.xipki.security.pkcs11.P11Slot in project xipki by xipki.

the class SpeedP11Action method getSlot.

protected P11Slot getSlot() throws XiSecurityException, P11TokenException, IllegalCmdParamException {
    P11CryptService p11Service = p11CryptServiceFactory.getP11CryptService(moduleName);
    if (p11Service == null) {
        throw new IllegalCmdParamException("undefined module " + moduleName);
    }
    P11Module module = p11Service.getModule();
    P11SlotIdentifier slotId = module.getSlotIdForIndex(slotIndex);
    return module.getSlot(slotId);
}
Also used : P11Module(org.xipki.security.pkcs11.P11Module) P11SlotIdentifier(org.xipki.security.pkcs11.P11SlotIdentifier) IllegalCmdParamException(org.xipki.console.karaf.IllegalCmdParamException) P11CryptService(org.xipki.security.pkcs11.P11CryptService)

Example 22 with P11Slot

use of org.xipki.security.pkcs11.P11Slot in project xipki by xipki.

the class BSpeedP11ECKeyGenCmd method nextTester.

@Override
protected LoadExecutor nextTester() throws Exception {
    ECControl control = queue.poll();
    if (control == null) {
        return null;
    }
    P11Slot slot = getSlot();
    return new P11ECKeyGenLoadTest(slot, control.curveName());
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) P11ECKeyGenLoadTest(org.xipki.security.speed.p11.P11ECKeyGenLoadTest) ECControl(org.xipki.security.speed.cmd.ECControl)

Example 23 with P11Slot

use of org.xipki.security.pkcs11.P11Slot in project xipki by xipki.

the class BSpeedP11RSAKeyGenCmd method nextTester.

@Override
protected LoadExecutor nextTester() throws Exception {
    RSAControl control = queue.poll();
    if (control == null) {
        return null;
    }
    P11Slot slot = getSlot();
    return new P11RSAKeyGenLoadTest(slot, control.modulusLen(), toBigInt("0x10001"));
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) P11RSAKeyGenLoadTest(org.xipki.security.speed.p11.P11RSAKeyGenLoadTest) RSAControl(org.xipki.security.speed.cmd.RSAControl)

Example 24 with P11Slot

use of org.xipki.security.pkcs11.P11Slot in project xipki by xipki.

the class P11CertDeleteCmd method execute0.

@Override
protected Object execute0() throws Exception {
    P11Slot slot = getSlot(moduleName, slotIndex);
    P11ObjectIdentifier objectId = slot.getObjectIdForId(Hex.decode(id));
    slot.removeCerts(objectId);
    println("deleted certificates");
    return null;
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier)

Example 25 with P11Slot

use of org.xipki.security.pkcs11.P11Slot in project xipki by xipki.

the class P11RSAKeyGenCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (keysize % 1024 != 0) {
        throw new IllegalCmdParamException("keysize is not multiple of 1024: " + keysize);
    }
    P11Slot slot = getSlot();
    P11ObjectIdentifier objId = slot.generateRSAKeypair(keysize, toBigInt(publicExponent), label, getControl());
    finalize("RSA", objId);
    return null;
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) IllegalCmdParamException(org.xipki.console.karaf.IllegalCmdParamException) P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier)

Aggregations

P11Slot (org.xipki.security.pkcs11.P11Slot)24 P11ObjectIdentifier (org.xipki.security.pkcs11.P11ObjectIdentifier)15 IllegalCmdParamException (org.xipki.console.karaf.IllegalCmdParamException)8 P11SlotIdentifier (org.xipki.security.pkcs11.P11SlotIdentifier)8 P11Module (org.xipki.security.pkcs11.P11Module)6 X509Certificate (java.security.cert.X509Certificate)5 P11CryptService (org.xipki.security.pkcs11.P11CryptService)5 P11TokenException (org.xipki.security.exception.P11TokenException)3 PublicKey (java.security.PublicKey)2 HashSet (java.util.HashSet)2 Asn1P11SlotIdentifier (org.xipki.p11proxy.msg.Asn1P11SlotIdentifier)2 Asn1ServerCaps (org.xipki.p11proxy.msg.Asn1ServerCaps)2 BadAsn1ObjectException (org.xipki.security.exception.BadAsn1ObjectException)2 P11Identity (org.xipki.security.pkcs11.P11Identity)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MalformedURLException (java.net.MalformedURLException)1 InvalidKeyException (java.security.InvalidKeyException)1