private SecretKey getSecretKeyObject(Session session, byte[] keyId, char[] keyLabel) throws P11TokenException { return (SecretKey) getKeyObject(session, new SecretKey(), keyId, keyLabel); }
@Override protected byte[] digestSecretKey0(long mechanism) throws P11TokenException { if (! (signingKey instanceof SecretKey)) { throw new P11TokenException("could not digest asymmetric key"); } Boolean bv = ((SecretKey) signingKey).getExtractable().getBooleanValue(); if (bv != null && !bv.booleanValue()) { throw new P11TokenException("could not digest unextractable key"); } bv = ((SecretKey) signingKey).getNeverExtractable().getBooleanValue(); if (bv != null && bv.booleanValue()) { throw new P11TokenException("could not digest unextractable key"); } return ((IaikP11Slot) slot).digestKey(mechanism, this); }
private void analyseSingleKey(SecretKey secretKey, P11SlotRefreshResult refreshResult) { byte[] id = secretKey.getId().getByteArrayValue(); char[] label = secretKey.getLabel().getCharArrayValue(); if (id == null || label == null) { return; } P11ObjectIdentifier objectId = new P11ObjectIdentifier(id, new String(label)); IaikP11Identity identity = new IaikP11Identity(this, new P11IdentityId(slotId, objectId, null, null), secretKey); refreshResult.addIdentity(identity); }
byte[] keyId = secKey.getId().getByteArrayValue(); if (keyId == null || keyId.length == 0) { continue;
labelChars = key.getLabel().getCharArrayValue();
getAttributeValue(session, objectHandle, keyTypeAttribute); keyType.longValue()); } else { newObject = getUnknownSecretKey(session, objectHandle);
/** * Compares all member variables of this object with the other object. * Returns only true, if all are equal in both objects. * * @param otherObject * The other object to compare to. * @return True, if other is an instance of this class and all member * variables of both objects are equal. False, otherwise. * @preconditions * @postconditions */ @Override public boolean equals(Object otherObject) { if (this == otherObject) { return true; } else if (!(otherObject instanceof ValuedSecretKey)) { return false; } ValuedSecretKey other = (ValuedSecretKey) otherObject; return super.equals(other) && this.value.equals(other.value) && this.valueLen.equals(other.valueLen); }
/** * Allocates the attribute objects for this class and adds them to the * attribute table. * * @preconditions * @postconditions */ @Override protected void allocateAttributes() { super.allocateAttributes(); value = new ByteArrayAttribute(Attribute.VALUE); valueLen = new LongAttribute(Attribute.VALUE_LEN); putAttributesInTable(this); }
newObject = Certificate.getInstance(session, objectHandle); } else if (objectClass.equals(ObjectClass.SECRET_KEY)) { newObject = SecretKey.getInstance(session, objectHandle); } else if (objectClass.equals(ObjectClass.DATA)) { newObject = Data.getInstance(session, objectHandle);
byte[] keyId = secKey.getId().getByteArrayValue(); if (keyId == null || keyId.length == 0) { continue;
labelChars = key.getLabel().getCharArrayValue();
private SecretKey getSecretKeyObject(final byte[] keyId, final char[] keyLabel) throws P11TokenException { return (SecretKey) getKeyObject(new SecretKey(), keyId, keyLabel); }
private void analyseSingleKey(final SecretKey secretKey, final P11SlotRefreshResult refreshResult) { byte[] id = secretKey.getId().getByteArrayValue(); P11ObjectIdentifier objectId = new P11ObjectIdentifier(id, toString(secretKey.getLabel())); IaikP11Identity identity = new IaikP11Identity(this, new P11EntityIdentifier(slotId, objectId), secretKey); refreshResult.addIdentity(identity); }
@Override protected byte[] digestSecretKey0(long mechanism) throws P11TokenException { if (! (signingKey instanceof SecretKey)) { throw new P11TokenException("could not digest asymmetric key"); } Boolean bv = ((SecretKey) signingKey).getExtractable().getBooleanValue(); if (bv != null && !bv.booleanValue()) { throw new P11TokenException("could not digest unextractable key"); } bv = ((SecretKey) signingKey).getNeverExtractable().getBooleanValue(); if (bv != null && bv.booleanValue()) { throw new P11TokenException("could not digest unextractable key"); } return ((IaikP11Slot) slot).digestKey(mechanism, this); }
private List<SecretKey> getAllSecretKeyObjects(Session session) throws P11TokenException { SecretKey template = new SecretKey(); List<Storage> tmpObjects = getObjects(session, template); if (CollectionUtil.isEmpty(tmpObjects)) { return Collections.emptyList(); } final int n = tmpObjects.size(); LOG.info("found {} private keys", n); List<SecretKey> keys = new ArrayList<>(n); for (Storage tmpObject : tmpObjects) { keys.add((SecretKey) tmpObject); } return keys; }
private List<SecretKey> getAllSecretKeyObjects() throws P11TokenException { ConcurrentBagEntry<Session> session0 = borrowSession(); try { Session session = session0.value(); SecretKey template = new SecretKey(); List<Storage> tmpObjects = getObjects(session, template); if (CollectionUtil.isEmpty(tmpObjects)) { return Collections.emptyList(); } final int n = tmpObjects.size(); LOG.info("found {} private keys", n); List<SecretKey> keys = new ArrayList<>(n); for (Storage tmpObject : tmpObjects) { SecretKey key = (SecretKey) tmpObject; keys.add(key); } return keys; } finally { sessions.requite(session0); } }