/** * The getInstance method of the PrivateKey class uses this method to create * an instance of a PKCS#11 ECDSA private key. * * @param session * The session to use for reading attributes. This session must * have the appropriate rights; i.e. it must be a user-session, if * it is a private object. * @param objectHandle * The object handle as given from the PKCS#111 module. * @return The object representing the PKCS#11 object. * The returned object can be casted to the * according sub-class. * @exception TokenException * If getting the attributes failed. * @preconditions (session <> null) * @postconditions (result <> null) */ public static PKCS11Object getInstance(Session session, long objectHandle) throws TokenException { return new ECPrivateKey(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 SM2PrivateKey)) { return false; } return super.equals(otherObject); }
/** * Default Constructor. * * @preconditions * @postconditions */ public ECPrivateKey() { keyType.setLongValue(thisKeyType()); }
/** * Allocates the attribute objects for this class and adds them to the * attribute table. * * @preconditions * @postconditions */ @Override protected void allocateAttributes() { super.allocateAttributes(); ecdsaParams = new ByteArrayAttribute(Attribute.EC_PARAMS); value = new ByteArrayAttribute(Attribute.VALUE); putAttributesInTable(this); }
newObject = DSAPrivateKey.getInstance(session, objectHandle); } else if (keyType.equals(Key.KeyType.EC)) { newObject = ECPrivateKey.getInstance(session, objectHandle); } else if (keyType.equals(Key.KeyType.DH)) { newObject = DHPrivateKey.getInstance(session, objectHandle);
assertMechanismSupported(mech); ECPrivateKey privateKey = new ECPrivateKey(); ECPublicKey publicKey = new ECPublicKey(); setKeyAttributes(control, publicKey, privateKey);
/** * Called by getInstance to create an instance of a PKCS#11 ECDSA private * key. * * @param session * The session to use for reading attributes. This session must * have the appropriate rights; i.e. it must be a user-session, if * it is a private object. * @param objectHandle * The object handle as given from the PKCS#111 module. * @exception TokenException * If getting the attributes failed. * @preconditions (session <> null) * @postconditions */ protected ECPrivateKey(Session session, long objectHandle) throws TokenException { super(session, objectHandle); keyType.setLongValue(thisKeyType()); }