boolean supportsMechanism(final long mechanism) { try { return p11CryptService.getSlot(identityId.slotId()).supportsMechanism(mechanism); } catch (P11TokenException ex) { return false; } }
protected void addIdentity(final P11Identity identity) throws P11DuplicateEntityException { if (!slotId.equals(identity.identityId().slotId())) { throw new IllegalArgumentException("invalid identity"); } P11ObjectIdentifier objectId = identity.identityId().objectId(); if (hasIdentity(objectId)) { throw new P11DuplicateEntityException(slotId, objectId); } identities.put(objectId, identity); updateCaCertsOfIdentity(identity); }
public Asn1P11EntityIdentifier(final P11EntityIdentifier entityId) { this.entityId = ParamUtil.requireNonNull("entityId", entityId); this.slotId = new Asn1P11SlotIdentifier(entityId.slotId()); this.objectId = new Asn1P11ObjectIdentifier(entityId.objectId()); }
public P11Identity getIdentity(final P11EntityIdentifier identityId) throws P11TokenException { ParamUtil.requireNonNull("identityId", identityId); return module.getSlot(identityId.slotId()).getIdentity(identityId.objectId()); }
P11ECDSAContentSigner(final P11CryptService cryptService, final P11EntityIdentifier identityId, final AlgorithmIdentifier signatureAlgId, final boolean plain) throws XiSecurityException, P11TokenException { this.cryptService = ParamUtil.requireNonNull("cryptService", cryptService); this.identityId = ParamUtil.requireNonNull("identityId", identityId); this.algorithmIdentifier = ParamUtil.requireNonNull("signatureAlgId", signatureAlgId); try { this.encodedAlgorithmIdentifier = algorithmIdentifier.getEncoded(); } catch (IOException ex) { throw new XiSecurityException("could not encode AlgorithmIdentifier", ex); } this.plain = plain; String algOid = signatureAlgId.getAlgorithm().getId(); HashAlgoType hashAlgo = sigAlgHashMap.get(algOid); if (hashAlgo == null) { throw new XiSecurityException("unsupported signature algorithm " + algOid); } P11Slot slot = cryptService.getSlot(identityId.slotId()); if (slot.supportsMechanism(PKCS11Constants.CKM_ECDSA)) { this.mechanism = PKCS11Constants.CKM_ECDSA; Digest digest = SignerUtil.getDigest(hashAlgo); this.outputStream = new DigestOutputStream(digest); } else { this.mechanism = hashMechMap.get(hashAlgo).longValue(); if (!slot.supportsMechanism(this.mechanism)) { throw new XiSecurityException("unsupported signature algorithm " + algOid); } this.outputStream = new ByteArrayOutputStream(); } }
P11SlotIdentifier slotId = identityId.slotId(); P11Slot slot = cryptService.getSlot(slotId); if (slot.supportsMechanism(PKCS11Constants.CKM_DSA)) {
P11SlotIdentifier slotId = identityId.slotId(); P11Slot slot = cryptService.getSlot(slotId); if (slot.supportsMechanism(PKCS11Constants.CKM_RSA_PKCS)) {
P11SlotIdentifier slotId = identityId.slotId(); P11Slot slot = cryptService.getSlot(slotId); if (slot.supportsMechanism(PKCS11Constants.CKM_RSA_PKCS_PSS)) {