<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>CanoKey on Rebel Zhang&#39;s Blog</title>
        <link>https://rebel1725.codeberg.page/blog/en/tags/canokey/</link>
        <description>Recent content in CanoKey on Rebel Zhang&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-GB</language>
        <managingEditor>rebel1725@tilde.club (Rebel Zhang)</managingEditor>
        <webMaster>rebel1725@tilde.club (Rebel Zhang)</webMaster>
        <lastBuildDate>Sat, 28 Mar 2026 17:33:41 +0800</lastBuildDate><atom:link href="https://rebel1725.codeberg.page/blog/en/tags/canokey/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>Verify the Authenticity of a CanoKey</title>
            <link>https://rebel1725.codeberg.page/blog/en/post/verify-the-authenticity-of-a-canokey/</link>
            <pubDate>Sat, 28 Mar 2026 17:33:41 +0800</pubDate><author>rebel1725@tilde.club (Rebel Zhang)</author>
            <guid>https://rebel1725.codeberg.page/blog/en/post/verify-the-authenticity-of-a-canokey/</guid>
            <description>&lt;p&gt;This post will guide you through verifying the authenticity of a CanoKey.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-1-obtain-the-attestation-root-ca-certificate&#34;&gt;Step 1: Obtain the attestation root CA certificate&#xA;&lt;/h2&gt;&lt;p&gt;Visit &lt;a class=&#34;link&#34; href=&#34;https://github.com/canokeys/canokey-product&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;this website&lt;/a&gt; to obtain the FIDO CA certificate for your model (Pigeon/Canary). Save the certificate as &lt;code&gt;ca.pem&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-2-install-fido2-cred&#34;&gt;Step 2: Install &lt;code&gt;fido2-cred&lt;/code&gt;&#xA;&lt;/h2&gt;&lt;p&gt;Install &lt;code&gt;fido2-cred&lt;/code&gt;. On Debian GNU/Linux, it is included in the &lt;code&gt;fido2-tools&lt;/code&gt; package:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&#xA;# apt install fido2-tools&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;step-3-verify-the-token&#34;&gt;Step 3: Verify the token&#xA;&lt;/h2&gt;&lt;p&gt;Plug in your CanoKey and run these commands:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&#xA;$ printf &amp;#39;%s\n&amp;#39; &amp;#34;$(openssl rand -base64 32)&amp;#34; &amp;#34;canokey-check.local&amp;#34; &amp;#34;tmp-user&amp;#34; &amp;#34;$(openssl rand -base64 32)&amp;#34; &amp;gt; cred.in&#xA;$ fido2-cred -M -i cred.in /dev/hidrawX &amp;gt; cred.out&#xA;$ sed -n &amp;#39;7p&amp;#39; cred.out | base64 -d &amp;gt; attestation.der&#xA;$ openssl x509 -inform der -in attestation.der -out attestation.pem&#xA;$ openssl verify -CAfile ca.pem attestation.pem&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If the last command returns &lt;code&gt;OK&lt;/code&gt;, then your CanoKey is authentic.&lt;/p&gt;&#xA;&lt;p&gt;The process can also be done with a script:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#!/usr/bin/env sh&#xA;set -eu&#xA;&#xA;die() {&#xA;    printf &amp;#39;%s\n&amp;#39; &amp;#34;Error: $*&amp;#34; &amp;gt;&amp;amp;2&#xA;    exit 1&#xA;}&#xA;&#xA;# Check required tools.&#xA;[ -x /usr/bin/fido2-cred ] || die &amp;#34;/usr/bin/fido2-cred does not exist or is not executable&amp;#34;&#xA;command -v openssl &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || die &amp;#34;openssl is not installed or not on PATH&amp;#34;&#xA;&#xA;# Find the device.&#xA;device=&amp;#34;${1:-}&amp;#34;&#xA;if [ -z &amp;#34;$device&amp;#34; ]; then&#xA;    set -- /dev/hidraw*&#xA;    if [ &amp;#34;$1&amp;#34; = &amp;#39;/dev/hidraw*&amp;#39; ]; then&#xA;        die &amp;#34;No /dev/hidraw* device found. Pass the device path as the first argument.&amp;#34;&#xA;    fi&#xA;    if [ &amp;#34;$#&amp;#34; -ne 1 ]; then&#xA;        die &amp;#34;More than one /dev/hidraw* device found. Pass the correct device path as the first argument.&amp;#34;&#xA;    fi&#xA;    device=$1&#xA;fi&#xA;&#xA;[ -e &amp;#34;$device&amp;#34; ] || die &amp;#34;Device not found: $device&amp;#34;&#xA;&#xA;tmpdir=&amp;#34;$(mktemp -d)&amp;#34;&#xA;cleanup() {&#xA;    rm -rf &amp;#34;$tmpdir&amp;#34;&#xA;}&#xA;trap cleanup EXIT INT TERM&#xA;&#xA;pigeon_ca=&amp;#34;$tmpdir/pigeon-ca.pem&amp;#34;&#xA;canary_ca=&amp;#34;$tmpdir/canary-ca.pem&amp;#34;&#xA;cred_in=&amp;#34;$tmpdir/cred.in&amp;#34;&#xA;cred_out=&amp;#34;$tmpdir/cred.out&amp;#34;&#xA;attestation_der=&amp;#34;$tmpdir/attestation.der&amp;#34;&#xA;attestation_pem=&amp;#34;$tmpdir/attestation.pem&amp;#34;&#xA;&#xA;cat &amp;gt; &amp;#34;$pigeon_ca&amp;#34; &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;&#xA;-----BEGIN CERTIFICATE-----&#xA;MIIBpzCCAUygAwIBAgIUatn9Rj8uCMjLrmFfCQYY5/X9xq4wCgYIKoZIzj0EAwIw&#xA;MTEvMC0GA1UEAwwmQ2Fub0tleXMgRklETyBBdHRlc3RhdGlvbiBSb290IENBIE5v&#xA;LjIwHhcNMjExMjI3MTE0OTMzWhcNNDEwNjI1MTE0OTMzWjAxMS8wLQYDVQQDDCZD&#xA;YW5vS2V5cyBGSURPIEF0dGVzdGF0aW9uIFJvb3QgQ0EgTm8uMjBZMBMGByqGSM49&#xA;AgEGCCqGSM49AwEHA0IABNgW7CwchH80l4sj8luhwjbNoohB9Uqnvsh0SLor18w8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;#34;Please touch the button of your token...&amp;#34;&#xA;printf &amp;#39;%s\n&amp;#39; &amp;#34;$(openssl rand -base64 32)&amp;#34; &amp;#34;canokey-check.local&amp;#34; &amp;#34;tmp-user&amp;#34; &amp;#34;$(openssl rand -base64 32)&amp;#34; &amp;gt; &amp;#34;$cred_in&amp;#34;&#xA;&#xA;/usr/bin/fido2-cred -M -i &amp;#34;$cred_in&amp;#34; &amp;#34;$device&amp;#34; &amp;gt; &amp;#34;$cred_out&amp;#34;&#xA;&#xA;sed -n &amp;#39;7p&amp;#39; &amp;#34;$cred_out&amp;#34; | base64 -d &amp;gt; &amp;#34;$attestation_der&amp;#34;&#xA;openssl x509 -inform der -in &amp;#34;$attestation_der&amp;#34; -out &amp;#34;$attestation_pem&amp;#34;&#xA;&#xA;if openssl verify -CAfile &amp;#34;$pigeon_ca&amp;#34; &amp;#34;$attestation_pem&amp;#34; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&#xA;    printf &amp;#39;%s\n&amp;#39; &amp;#34;OK: verification succeeded against the Pigeon root CA.&amp;#34;&#xA;elif openssl verify -CAfile &amp;#34;$canary_ca&amp;#34; &amp;#34;$attestation_pem&amp;#34; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&#xA;    printf &amp;#39;%s\n&amp;#39; &amp;#34;OK: verification succeeded against the Canary root CA.&amp;#34;&#xA;else&#xA;    die &amp;#34;Verification failed: the attestation certificate did not verify against either root CA.&amp;#34;&#xA;fi&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
        </item></channel>
</rss>
