Net.Pkcs11Interop.HighLevelAPI81.Session.SetPin C# (CSharp) Method

SetPin() public method

Modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in.
public SetPin ( byte oldPin, byte newPin ) : void
oldPin byte Old PIN value
newPin byte New PIN value
return void
        public void SetPin(byte[] oldPin, byte[] newPin)
        {
            if (this._disposed)
                throw new ObjectDisposedException(this.GetType().FullName);

            byte[] oldPinValue = null;
            ulong oldPinValueLen = 0;
            if (oldPin != null)
            {
                oldPinValue = oldPin;
                oldPinValueLen = Convert.ToUInt64(oldPin.Length);
            }
            
            byte[] newPinValue = null;
            ulong newPinValueLen = 0;
            if (newPin != null)
            {
                newPinValue = newPin;
                newPinValueLen = Convert.ToUInt64(newPin.Length);
            }
            
            CKR rv = _p11.C_SetPIN(_sessionId, oldPinValue, oldPinValueLen, newPinValue, newPinValueLen);
            if (rv != CKR.CKR_OK)
                throw new Pkcs11Exception("C_SetPIN", rv);
        }

Same methods

Session::SetPin ( string oldPin, string newPin ) : void