pub unsafe fn ykpiv_change_pin(
    state: *mut YubiKey,
    current_pin: *const c_char,
    current_pin_len: usize,
    new_pin: *const c_char,
    new_pin_len: usize,
    tries: *mut i32,
) -> ErrorKind {
    let mut res: ErrorKind = ErrorKind::GenericError;

    if _ykpiv_begin_transaction(state) != ErrorKind::Ok {
        return ErrorKind::PcscError;
    }

    if _ykpiv_ensure_application_selected(state) == ErrorKind::Ok {
        res = _ykpiv_change_pin(
            state,
            0,
            current_pin,
            current_pin_len,
            new_pin,
            new_pin_len,
            tries,
        );

        if res == ErrorKind::Ok && !new_pin.is_null() {
            // Intentionally ignore errors.  If the PIN fails to save, it will only
            // be a problem if a reconnect is attempted.  Failure deferred until then.
            _cache_pin(state, new_pin, new_pin_len);
        }
    }

    _ykpiv_end_transaction(state);
    res
}
/// Change the Personal Identification Number (PIN).
///
/// The default PIN code is 123456
Change the Personal Identification Number (PIN).
The default PIN code is 123456
Change the Personal Identification Number ( PIN ) . The default PIN code is 123456
pub unsafe fn ykpiv_change_pin(
    state: *mut YubiKey,
    current_pin: *const c_char,
    current_pin_len: usize,
    new_pin: *const c_char,
    new_pin_len: usize,
    tries: *mut i32,
) -> ErrorKind {
    let mut res: ErrorKind = ErrorKind::GenericError;
    if _ykpiv_begin_transaction(state) != ErrorKind::Ok {
        return ErrorKind::PcscError;
    }
    if _ykpiv_ensure_application_selected(state) == ErrorKind::Ok {
        res = _ykpiv_change_pin(
            state,
            0,
            current_pin,
            current_pin_len,
            new_pin,
            new_pin_len,
            tries,
        );
        if res == ErrorKind::Ok && !new_pin.is_null() {
            // Intentionally ignore errors.  If the PIN fails to save, it will only
            // be a problem if a reconnect is attempted.  Failure deferred until then.
            _cache_pin(state, new_pin, new_pin_len);
        }
    }
    _ykpiv_end_transaction(state);
    res
}
pub unsafe fn ykpiv_change_pin ( state : * mut YubiKey , current_pin : * const c_char , current_pin_len : usize , new_pin : * const c_char , new_pin_len : usize , tries : * mut i32 , ) -> ErrorKind { let mut res : ErrorKind = ErrorKind :: GenericError ; if _ykpiv_begin_transaction ( state ) != ErrorKind :: Ok { return ErrorKind :: PcscError ; } if _ykpiv_ensure_application_selected ( state ) == ErrorKind :: Ok { res = _ykpiv_change_pin ( state , 0 , current_pin , current_pin_len , new_pin , new_pin_len , tries , ) ; if res == ErrorKind :: Ok && ! new_pin . is_null ( ) { // Intentionally ignore errors.  If the PIN fails to save, it will only // be a problem if a reconnect is attempted.  Failure deferred until then. _cache_pin ( state , new_pin , new_pin_len ) ; } } _ykpiv_end_transaction ( state ) ; res }
Change the Personal Identification Number (PIN).
Change the Personal Identification Number ( PIN ) .
state
*mut YubiKey
current_pin
*const c_char
current_pin_len
usize
new_pin
*const c_char
new_pin_len
usize
tries
*mut i32