public boolean supportsMechanism(long mechanism) { try { return p11CryptService.getSlot(identityId.getSlotId()).supportsMechanism(mechanism); } catch (P11TokenException ex) { return false; } }
boolean supportsMechanism(final long mechanism) { try { return p11CryptService.getSlot(identityId.slotId()).supportsMechanism(mechanism); } catch (P11TokenException ex) { return false; } }
private byte[] getPlainSignature() throws XiSecurityException, P11TokenException { byte[] dataToSign; if (outputStream instanceof ByteArrayOutputStream) { dataToSign = ((ByteArrayOutputStream) outputStream).toByteArray(); ((ByteArrayOutputStream) outputStream).reset(); } else { dataToSign = ((DigestOutputStream) outputStream).digest(); ((DigestOutputStream) outputStream).reset(); } return cryptService.getIdentity(identityId).sign(mechanism, null, dataToSign); } }
protected void addIdentity(P11Identity identity) throws P11DuplicateEntityException { if (!slotId.equals(identity.getId().getSlotId())) { throw new IllegalArgumentException("invalid identity"); } P11ObjectIdentifier keyId = identity.getId().getKeyId(); if (hasIdentity(keyId)) { throw new P11DuplicateEntityException(slotId, keyId); } identities.put(keyId, identity); updateCaCertsOfIdentity(identity); }
@Override public byte[] processBlock(byte[] in, int inOff, int len) throws InvalidCipherTextException { byte[] content = new byte[getInputBlockSize()]; System.arraycopy(in, inOff, content, content.length - len, len); try { P11Identity identity = param.getP11CryptService().getIdentity(param.getIdentityId()); return identity.sign(PKCS11Constants.CKM_RSA_X_509, null, content); } catch (P11TokenException ex) { throw new InvalidCipherTextException(ex.getMessage(), ex); } }
public P11Identity getIdentity(P11SlotIdentifier slotId, P11ObjectIdentifier keyId) throws P11TokenException { P11Slot slot = module.getSlot(slotId); return (slot == null) ? null : slot.getIdentity(keyId); }
public P11SlotIdentifier getSlotIdForIndex(int index) throws P11UnknownEntityException { for (P11SlotIdentifier id : slotIds) { if (id.getIndex() == index) { return id; } } throw new P11UnknownEntityException("could not find slot with index " + index); }
public P11SlotIdentifier getSlotIdForId(long id) throws P11UnknownEntityException { for (P11SlotIdentifier slotId : slotIds) { if (slotId.getId() == id) { return slotId; } } throw new P11UnknownEntityException("could not find slot with id " + id); }
private byte[] getPlainSignature() throws XiSecurityException, P11TokenException { byte[] dataToSign; if (outputStream instanceof ByteArrayOutputStream) { dataToSign = ((ByteArrayOutputStream) outputStream).toByteArray(); ((ByteArrayOutputStream) outputStream).reset(); } else { dataToSign = ((DigestOutputStream) outputStream).digest(); ((DigestOutputStream) outputStream).reset(); } return cryptService.getIdentity(identityId).sign(mechanism, null, dataToSign); } }
public boolean supportsMechanism(long mechanism) { try { return p11CryptService.getSlot(identityId.getSlotId()).supportsMechanism(mechanism); } catch (P11TokenException ex) { return false; } }
public P11Identity getIdentity(P11SlotIdentifier slotId, P11ObjectIdentifier keyId) throws P11TokenException { P11Slot slot = module.getSlot(slotId); return (slot == null) ? null : slot.getIdentity(keyId); }
private byte[] getPlainSignature() throws XiSecurityException, P11TokenException { byte[] dataToSign; if (outputStream instanceof ByteArrayOutputStream) { dataToSign = ((ByteArrayOutputStream) outputStream).toByteArray(); ((ByteArrayOutputStream) outputStream).reset(); } else { dataToSign = ((DigestOutputStream) outputStream).digest(); ((DigestOutputStream) outputStream).reset(); } return cryptService.getIdentity(identityId).sign(mechanism, null, dataToSign); }
private byte[] getPlainSignature() throws XiSecurityException, P11TokenException { byte[] dataToSign; if (outputStream instanceof ByteArrayOutputStream) { dataToSign = ((ByteArrayOutputStream) outputStream).toByteArray(); ((ByteArrayOutputStream) outputStream).reset(); } else { dataToSign = ((DigestOutputStream) outputStream).digest(); ((DigestOutputStream) outputStream).reset(); } return cryptService.getIdentity(identityId).sign(mechanism, null, dataToSign); }