When private key object is not found on the token (e.g. when PIN was not provided) and instance of Pkcs11*Provider is acquired via Get*PublicKey() method, then any method working with private key (e.g. SignHash) throws System.ArgumentNullException: Value cannot be null. (Parameter 'keyHandle').
Situation is exactly the same when public key object is not found on the token (e.g. some tokens do not store public keys) and instance of Pkcs11*Provider is acquired via Get*PrivteKey() method. Any method working with public key (e.g. VerifyHash) throws System.ArgumentNullException: Value cannot be null. (Parameter 'keyHandle').
Better exception should be thrown in this scenarios.
When private key object is not found on the token (e.g. when PIN was not provided) and instance of
Pkcs11*Provider
is acquired viaGet*PublicKey()
method, then any method working with private key (e.g.SignHash
) throwsSystem.ArgumentNullException: Value cannot be null. (Parameter 'keyHandle')
.Situation is exactly the same when public key object is not found on the token (e.g. some tokens do not store public keys) and instance of
Pkcs11*Provider
is acquired viaGet*PrivteKey()
method. Any method working with public key (e.g.VerifyHash
) throwsSystem.ArgumentNullException: Value cannot be null. (Parameter 'keyHandle')
.Better exception should be thrown in this scenarios.