public void SetPin(string oldPin, string newPin)
{
if (this._disposed)
throw new ObjectDisposedException(this.GetType().FullName);
byte[] oldPinValue = null;
ulong oldPinValueLen = 0;
if (oldPin != null)
{
oldPinValue = ConvertUtils.Utf8StringToBytes(oldPin);
oldPinValueLen = Convert.ToUInt64(oldPinValue.Length);
}
byte[] newPinValue = null;
ulong newPinValueLen = 0;
if (newPin != null)
{
newPinValue = ConvertUtils.Utf8StringToBytes(newPin);
newPinValueLen = Convert.ToUInt64(newPinValue.Length);
}
CKR rv = _p11.C_SetPIN(_sessionId, oldPinValue, oldPinValueLen, newPinValue, newPinValueLen);
if (rv != CKR.CKR_OK)
throw new Pkcs11Exception("C_SetPIN", rv);
}