Search in sources :

Example 26 with P11ObjectIdentifier

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

the class P11RSAKeyGenLoadTest method genKeypair.

@Override
protected void genKeypair() throws Exception {
    P11ObjectIdentifier objId = slot.generateRSAKeypair(keysize, publicExponent, getDummyLabel(), getControl());
    slot.removeIdentity(objId);
}
Also used : P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier)

Example 27 with P11ObjectIdentifier

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

the class P11SM2KeyGenLoadTest method genKeypair.

@Override
protected void genKeypair() throws Exception {
    P11ObjectIdentifier objId = slot.generateSM2Keypair(getDummyLabel(), getControl());
    slot.removeIdentity(objId);
}
Also used : P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier)

Example 28 with P11ObjectIdentifier

use of org.xipki.security.pkcs11.P11ObjectIdentifier 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 29 with P11ObjectIdentifier

use of org.xipki.security.pkcs11.P11ObjectIdentifier 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)

Example 30 with P11ObjectIdentifier

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

the class P11CertAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    X509Certificate cert = X509Util.parseCert(certFile);
    P11Slot slot = getSlot(moduleName, slotIndex);
    P11ObjectIdentifier objectId = slot.addCert(cert);
    println("added certificate under " + objectId);
    return null;
}
Also used : P11Slot(org.xipki.security.pkcs11.P11Slot) P11ObjectIdentifier(org.xipki.security.pkcs11.P11ObjectIdentifier) X509Certificate(java.security.cert.X509Certificate)

Aggregations

P11ObjectIdentifier (org.xipki.security.pkcs11.P11ObjectIdentifier)30 P11EntityIdentifier (org.xipki.security.pkcs11.P11EntityIdentifier)15 P11Slot (org.xipki.security.pkcs11.P11Slot)15 P11TokenException (org.xipki.security.exception.P11TokenException)10 X509Certificate (java.security.cert.X509Certificate)8 Asn1P11EntityIdentifier (org.xipki.p11proxy.msg.Asn1P11EntityIdentifier)6 IllegalCmdParamException (org.xipki.console.karaf.IllegalCmdParamException)5 Session (iaik.pkcs.pkcs11.Session)4 TokenException (iaik.pkcs.pkcs11.TokenException)4 PublicKey (java.security.PublicKey)4 DEROctetString (org.bouncycastle.asn1.DEROctetString)4 X509Cert (org.xipki.security.X509Cert)4 XiSecurityException (org.xipki.security.exception.XiSecurityException)4 SecretKey (iaik.pkcs.pkcs11.objects.SecretKey)3 ValuedSecretKey (iaik.pkcs.pkcs11.objects.ValuedSecretKey)3 InvalidKeyException (java.security.InvalidKeyException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 CertificateException (java.security.cert.CertificateException)3 P11SlotRefreshResult (org.xipki.security.pkcs11.P11SlotRefreshResult)3 Mechanism (iaik.pkcs.pkcs11.Mechanism)2