Search in sources :

Example 6 with P11Slot

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

the class P11IdentityDeleteCmd method execute0.

@Override
protected Object execute0() throws Exception {
    P11Slot slot = getSlot();
    P11ObjectIdentifier objIdentifier = getObjectIdentifier();
    if (objIdentifier == null) {
        println("identity to be deleted does not exist");
        return null;
    }
    if (force || confirm("Do you want to remove the identity " + objIdentifier, 3)) {
        slot.removeIdentity(objIdentifier);
        println("deleted identity " + objIdentifier);
    }
    return null;
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier)

Example 7 with P11Slot

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

the class BSpeedP11Action 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 8 with P11Slot

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

the class BSpeedP11DSAKeyGenCmd method nextTester.

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

Example 9 with P11Slot

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

the class P11CertExportCmd method execute0.

@Override
protected Object execute0() throws Exception {
    P11Slot slot = getSlot();
    P11ObjectIdentifier objIdentifier = getObjectIdentifier();
    X509Certificate cert = slot.exportCert(objIdentifier);
    if (cert == null) {
        throw new CmdFailure("could not export certificate " + objIdentifier);
    }
    saveVerbose("saved certificate to file", new File(outFile), cert.getEncoded());
    return null;
}
Also used : CmdFailure(org.xipki.console.karaf.CmdFailure) P11Slot(org.xipki.security.pkcs11.P11Slot) P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier) File(java.io.File) X509Certificate(java.security.cert.X509Certificate)

Example 10 with P11Slot

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

the class P11ECKeyGenCmd method execute0.

@Override
protected Object execute0() throws Exception {
    P11Slot slot = getSlot();
    P11ObjectIdentifier objId = slot.generateECKeypair(curveName, label, getControl());
    finalize("EC", objId);
    return null;
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) 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