CTAP에서 YubikeyBio의 생물 측정을 봤어요.

개시하다


생체측정에 대응하는 유비키바이오의 생체정보 관리·인증 기능을 검증했다.
https://www.yubico.com/products/yubikey-bio-series/

FIDO2 - CTAP 2.1


유비키바이오는 국제표준 FIDO2 협약으로 시행됐다.FIDO2의 규격은 공개됐고, 유비키바이오는 FIDO2의 CTAP 규격에 따라 조작한다.CTAP 2.1 버전에 생체측정이 추가돼 이 규격을 구현한 제품은 유비키바이오다.
구체적으로 다음과 같다.
Client to Authenticator Protocol (CTAP) Proposed Standard, June 15, 2021
특히 생물정보 관리와 관련된 명령은 다음과 같다.
  • 6.7. authenticatorBioEnrollment (0x09)
  • 검증 방법


    유비키바이오의 생체측정은 어떤 건가요?FIDO2 DEMO 웹 사이트나 크롬의 보안 키 관리 기능을 통해 확인할 수 있지만 여기서는 CTAP 레벨로 확인할 수 있습니다.
    MacOS에서 CTAP 2.1에 대응하는 도구 라이브러리를 사용하여 검증했습니다.

    ctapcli (명령행 도구)


    ctap2.1을 실행하는 명령행 도구입니다.맥 전용입니다.
    다음 brew 명령 2개를 사용하여 설치할 수 있습니다.
    brew tap gebogebogebo/tap
    brew install ctapcli
    
    バージョン 0.0.8 以降で Yubikey Bio 対応です。
    % ctapcli -V
    ctapcli 0.0.8
    
    ctapcli의 상세한 내용은 아래의 내용을 참조하십시오.
    https://github.com/gebogebogebo/homebrew-tap
    FIDO 키 PIN 또는 디스플레이 사양을 설정하는 도구 제작

    ctap_hid_fido2(Rust 크레인)


    ctap의 Rust 크레인
    다음 장소에서 공개한다.
    crates.io

    유비키바이오의 바이오 데이터 관리 기능


    보안 키가 바이오메트릭 측정을 지원하는지 확인


    ctapcli


    ctapcli에서 info 하위 명령--get bio 옵션을 통해 생물 측정에 대응하는 키인지 확인할 수 있습니다.
    % ctapcli info --get bio
    Get the Authenticator infomation.
    
    option bio = true
    
    bioEnroll
    This authenticator supports the authenticatorBioEnrollment commands, and has at least one bio enrollment presently provisioned.
    

    ctap_hid_fido2


    ctap_hid_fido2 라이브러리에서enable_info_option()에서 지정InfoOption::BioEnroll하면 생물 측정이 지원되는지 확인할 수 있습니다.
    if ctap_hid_fido2::enable_info_option(&Cfg::init(), &InfoOption::BioEnroll)?.is_some(){
        Ok(true)
    } else {
        Ok(false)
    }
    

    지문 센서 정보 얻기


    ctapcli


    bio 하위 명령--info 옵션을 통해 지문 센서 정보를 표시합니다.
    % ctapcli bio --info
    Bio Management.
    
    Display sensor info.
    - Modality
      - Fingerprint
    - Fingerprint kind
      - touch type fingerprints
    - Maximum good samples required for enrollment
      - 16
    - Maximum number of bytes the authenticator will accept as a templateFriendlyName
      - 15
    

    ctap_hid_fido2

    bio_enrollment_get_fingerprint_sensor_info() 지문 센서 정보를 얻을 수 있습니다.
    let sensor_info = ctap_hid_fido2::bio_enrollment_get_fingerprint_sensor_info(
        &Cfg::init(),
    )?;
    
    센서 정보는BioSensorInfo형struct입니다.
  • Modality는 정의Fingerprint만 가능합니다.
  • FingerprintKind는TouchType 또는SwipeType이다.유비키바이오의 경우TouchType다.
  • maxC a p t u e Samples Required ForEnroll은 지문 로그인에 필요한 샘플 수입니다.유비키바이오의 경우는 4.
  • maxTemplateFriendlyName은 등록할 때 설정할 수 있는 이름의 최대 바이트입니다.유비키바이오의 경우?네.
  • 지문을 등록하다


    ctapcli


    bio 하위 명령--enroll을 통해 상호작용 모드에서 지문을 등록할 수 있습니다.등록할 때 PIN을 입력해야 합니다.
    % ctapcli bio --enroll
    Bio Management.
    
    Enrolling fingerprint.
    PIN: [PINを入力してENTER]
    
    bio enrollment
    Please follow the instructions to touch the sensor on the authenticator.
    
    Press any key to start the registration.
    
    [ENTERを入力すると登録開始]
    
    - Touch the sensor on the authenticator
    [キーのセンサをタッチする]
    
    Good fingerprint capture. 0x00: CTAP2_ENROLL_FEEDBACK_FP_GOOD
    - Number of samples required = 4
    
    - Touch the sensor on the authenticator
    [キーのセンサをタッチする]
    
    Good fingerprint capture. 0x00: CTAP2_ENROLL_FEEDBACK_FP_GOOD
    - Number of samples required = 3
    
    - Touch the sensor on the authenticator
    [キーのセンサをタッチする]
    
    Good fingerprint capture. 0x00: CTAP2_ENROLL_FEEDBACK_FP_GOOD
    - Number of samples required = 2
    
    - Touch the sensor on the authenticator
    [キーのセンサをタッチする]
    
    Good fingerprint capture. 0x00: CTAP2_ENROLL_FEEDBACK_FP_GOOD
    - Number of samples required = 1
    
    - Touch the sensor on the authenticator
    [キーのセンサをタッチする]
    
    Good fingerprint capture. 0x00: CTAP2_ENROLL_FEEDBACK_FP_GOOD
    - Number of samples required = 0
    
    - bio enrollment Success
    
    templateId: "0B27"
    
    input name:
    [右手親指などの登録名を入力してENTER]
    
    - Success
    
    

    ctap_hid_fido2


    상기 ctapcli bio --enroll는 동작이다hid_다음 세 가지 지령으로fido2를 실현하였다.
  • bio_enrollment_begin()
  • bio_enrollment_next()
  • bio_enrollment_set_friendly_name()
  • bio_enrollment_begin()


    지문 등록을 시작하다.매개변수에 PIN 및 스캔 제한 시간(ms)을 지정합니다.호출 후 지문 스캔을 시작하고 스캔이 완료되면 돌아옵니다.반환 값은 EnrollStatus1EnrollStatus2의 원조의 Result이다.
    let (enroll_status1,enroll_status2) = ctap_hid_fido2::bio_enrollment_begin(&Cfg::init(), Some(pin), Some(10000))?;
    
  • EnrollStatius 1: bio_enrollment_next()에 제공된 데이터입니다.
  • devide: 내부 데이터
  • cid: 내부 데이터
  • pin_token: 내부 데이터
  • template_템플릿 ID
  • EnrollStatus 2: 지문 검색 결과.
  • status = lastEnrollSampleStatus Value
  • 메시지 = 위 status에 해당하는 메시지
  • remaining_samples=remainingSamples(등록 완료 전 필요한 스캔 횟수)
  • is_finish=등록이 완료되었는지 여부
  • bio_enrollment_next()


    지문 등록을 완성하기 위해서는 몇 번의 스캐닝이 필요하다.먼저 bio_enrollment_begin(), 그리고 bio_enrollment_next() 스캔합니다.지정한 bio_enrollment_next() 인자 bio_enrollment_begin() 에서 얻은 것) EnrollStatus1.
    let enroll_status2 = ctap_hid_fido2::bio_enrollment_next(&Cfg::init(), enroll_status1, Some(10000))?;
    
    enroll_status2.is_finishtrue로 바뀌면 지문 등록이 완료됩니다.

    bio_enrollment_set_friendly_name()


    등록된 지문의 표시 이름을 설정합니다.매개변수에 PIN, 템플릿 ID 및 표시 이름을 지정합니다.템플릿 ID 지정bio_enrollment_begin()에서 가져올 내용입니다.
    ctap_hid_fido2::bio_enrollment_set_friendly_name(
        &Cfg::init(),
        pin,
        template_id,
        "display-name",
    )?;
    

    등록된 지문을 얻다


    ctapcli

    ctapcli bio만 있으면 등록된 지문이 표시됩니다.다음 예의 경우 0000은 템플릿 ID이고 테스트는 디스플레이 이름입니다.
    % ctapcli bio    
    Bio Management.
    
    List registered biometric authenticate data.
    PIN: [PINを入力してENTER]
    
    Number of registrations = 2
    0000 : test
    0001 : 右手親指
    

    ctap_hid_fido2


    ctap_hid_fido2bio_enrollment_enumerate_enrollments()에서 목록에서 로그인 정보를 얻을 수 있습니다.
    let template_infos = ctap_hid_fido2::bio_enrollment_enumerate_enrollments(&Cfg::init(), pin)?;
    
    위의templateinfos는 Vec<TemplateInfo>형입니다.

    지문 삭제


    ctapcli

    ctapcli bio -d テンプレートID에서 하나를 삭제합니다.다음은 템플릿 ID0001를 삭제한 예입니다.
    % ctapcli bio -d 0001
    Bio Management.
    
    Delete a fingerprint.
    PIN: [PINを入力してENTER]
    
    Delete enrollment
    value for templateId: "0001"
    
    - Success
    

    ctap_hid_fido2

    bio_enrollment_remove()에서 삭제됩니다.매개 변수에 템플릿 ID를 지정합니다.
    ctap_hid_fido2::bio_enrollment_remove(&Cfg::init(), pin, &template_id)?;
    

    유비키바이오 지문을 통한 얼굴 등록 및 인증


    ctapcli


    ctapclictapcli bio --test에서 지문의 등록과 인증을 테스트할 수 있습니다.
    % ctapcli bio -t
    Bio Management.
    
    Test register and authenticate.
    
    Register
    - Touch the sensor on the authenticator
    [ここでキーをタッチして指紋認証]
    
    Verify
    Register Success !!
    
    Authenticate
    - Touch the sensor on the authenticator
    [ここでキーをタッチして指紋認証]
    
    Verify
    Authenticate Success !!
    
    Register and Authenticate Success
    

    ctap_hid_fido2


    지문 인증으로 등록하고 인증하는 방법.make_credential()는 신용카드가 등록된 API로 핀 매개 변수에 None을 지정하면 지문인증을 통해 등록한다.
    let rpid = "ctapcli.test";
    let challenge = verifier::create_challenge();
    let pin = None;
    
    let att = ctap_hid_fido2::make_credential(
            &Cfg::init(),
            rpid,
            &challenge,
            pin
    )?;
    
    인증get_assertion()마찬가지로 핀 파라미터에 None을 지정하면 지문인증이다.
    let pin = None;
    
    let ass = ctap_hid_fido2::get_assertion(
            &Cfg::init(),
            rpid,
            &challenge,
            &verify_result.credential_id,
            pin,
    )?;
    

    지문 인증 잠금 카운터 조사


    PIN과 마찬가지로 지문 인증에도 카운터가 있어 연속으로 잘못되면 잠긴다.생체측정이 잠긴 경우 PIN 인증을 통과하면 자동으로 해제된다.

    ctapcli

    ctapcli pin 명령을 실행하면 일반 PIN 재시도 카운터와 지문 인증 재시도 카운터를 사용할 수 있습니다.
    % ctapcli pin
    PIN Management.
    
    Get PIN retry counter.
    
    PIN retry counter = 8
    
    :) :) :) :) :) :) :) :) 
    
    PIN retry counter represents the number of attempts left before PIN is disabled.
    Each correct PIN entry resets the PIN retry counters back to their maximum values.
    Each incorrect PIN entry decrements the counter by 1.
    Once the PIN retry counter reaches 0, built-in user verification are disabled and can only be enabled if authenticator is reset.
    
    
    Get UV retry counter.
    
    UV retry counter = 3
    
    UV retries count is the number of built-in UV attempts remaining before built-in UV is disabled on the device.
    

    ctap_hid_fido2

    get_uv_retries() 지문 인증 재시도 횟수를 획득할 수 있습니다.
    match ctap_hid_fido2::get_uv_retries(&Cfg::init()) {
    	Ok(v) => println!("UV retry counter = {}", v),
    	Err(err) => return Err(err),
    };
    

    수고하셨습니다.


    어쨌든 이런 느낌의 검증이야.
    CTAP 명령에 대한 자세한 내용은 소스 파일만 보면 될 것 같습니다.
    https://github.com/gebogebogebo/ctap-hid-fido2

    좋은 웹페이지 즐겨찾기