Set the PIN

Namespace:  Cryptware.NCryptoki
Assembly:  NCryptoki (in NCryptoki.dll)

Syntax

Visual Basic (Declaration)
Public Function SetPIN ( _
	oldPin As Byte(), _
	newPin As Byte() _
) As Integer
C#
public int SetPIN(
	byte[] oldPin,
	byte[] newPin
)
Visual C++
public:
virtual int SetPIN(
	[InAttribute] array<unsigned char>^ oldPin, 
	[InAttribute] array<unsigned char>^ newPin
) sealed
JavaScript
function setPIN(oldPin, newPin);

Parameters

oldPin
Type: array<System..::..Byte>[]()[]
old pin
newPin
Type: array<System..::..Byte>[]()[]
new pin

Return Value

0 if no error occurs, PKCS#11 error code otherwise

Implements

ISession..::..SetPIN(array<Byte>[]()[][], array<Byte>[]()[][])

Remarks

SetPIN modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in. OldPin points to the old PIN; NewPin points to the new PIN; This standard allows PIN values to contain any valid UTF8 character, but the token may impose subset restrictions. C_SetPIN can only be called in the “R/W Public Session” state, “R/W SO Functions” state, or “R/W User Functions” state. An attempt to call it from a session in any other state fails with error CKR_SESSION_READ_ONLY. If the token has a “protected authentication path”, as indicated by the CKF_PROTECTED_AUTHENTICATION_PATH flag in its CK_TOKEN_INFO being set, then that means that there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library. One such possibility is that the user enters a PIN on a PINpad on the token itself, or on the slot device. To modify the current user’s PIN on a token with such a protected authentication path, the OldPin and NewPin parameters to SetPIN should be null. During the execution of SetPIN, the current user will enter the old PIN and the new PIN through the protected authentication path. It is not specified how the PINpad should be used to enter two PINs; this varies. If the token has a protected authentication path other than a PINpad, then it is tokendependent whether or not SetPIN can be used to modify the current user’s PIN

See Also