<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>rool - 我的生活经历</title><link>https://www.rool.me/</link><description>Recent content on rool - 我的生活经历</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><managingEditor>heqing@rool.me (rool)</managingEditor><webMaster>heqing@rool.me (rool)</webMaster><copyright>rool - 我的生活经历 | &lt;img style="width: 18px;" src="https://www.rool.me/备案图标.png">&lt;a href="https://beian.mps.gov.cn/#/query/webSearch?code=51012202001920" rel="noreferrer" target="_blank">川公网安备51012202001920&lt;/a>&lt;a style="margin-left: 20px;" href="https://beian.miit.gov.cn/">蜀ICP备18031429号-2&lt;/a></copyright><lastBuildDate>Fri, 12 Dec 2025 16:39:56 +0800</lastBuildDate><atom:link href="https://www.rool.me/index.xml" rel="self" type="application/rss+xml"/><item><title>gpg使用攻略</title><link>https://www.rool.me/post/gpg%E4%BD%BF%E7%94%A8%E6%94%BB%E7%95%A5/</link><pubDate>Fri, 12 Dec 2025 16:39:56 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/gpg%E4%BD%BF%E7%94%A8%E6%94%BB%E7%95%A5/</guid><description>&lt;p>
使用gpg能做的一些事情, 以及一些注意事项和建议.&lt;/p>
&lt;div id="outline-container-headline-1" class="outline-2">
&lt;h2 id="headline-1">
gpg能用来干嘛
&lt;/h2>
&lt;div id="outline-text-headline-1" class="outline-text-2">
&lt;ol>
&lt;li>加密/解密 &lt;/li>
&lt;li>签名&lt;/li>
&lt;li>认证&lt;/li>
&lt;/ol>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-2" class="outline-2">
&lt;h2 id="headline-2">
gpg软件准备
&lt;/h2>
&lt;div id="outline-text-headline-2" class="outline-text-2">
&lt;p>这里都指GnuPG
linux发行版都可以直接通过软件仓库安装, apt/yum
macOS可以用brew安装
版本要求: &amp;gt;= 2.1.7
理由: GnuPG 2.1.7开始, 支持Curve25519, 有兴趣的朋友可以去了解一下Curve25519 Ed25519 ecdsa rsa等算法的区别和对比.
我们这里选择最优和最安全的, 所以就是Curve25519和Ed25519&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-3" class="outline-2">
&lt;h2 id="headline-3">
使用过程
&lt;/h2>
&lt;div id="outline-text-headline-3" class="outline-text-2">
&lt;div id="outline-container-headline-4" class="outline-3">
&lt;h3 id="headline-4">
生成主密钥, 有效期为永久
&lt;/h3>
&lt;div id="outline-text-headline-4" class="outline-text-3">
&lt;p>&lt;strong>&lt;strong>这里一定注意, 只生成认证（Certify）&lt;/strong>&lt;/strong>&lt;/p>
&lt;div class="src src-bash">
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">23
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">24
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">25
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">26
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">27
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">28
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">29
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">30
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">31
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">32
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">33
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">34
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">35
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">36
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">37
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">38
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">39
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">40
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">41
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">42
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">43
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">44
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">45
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">46
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">47
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">48
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">49
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">50
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">51
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">52
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">53
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">54
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">55
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">56
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">57
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">58
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">59
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">60
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">61
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">62
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">63
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">64
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">65
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">66
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">67
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">68
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">69
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">70
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">71
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">72
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">73
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">74
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">75
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">76
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>gpg --expert --full-generate-key  ✔  11m 56s   23:09:50 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>GnuPG&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 2.4.8; Copyright &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>C&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#a5d6ff">2025&lt;/span> g10 Code GmbH
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>This is free software: you are free to change and redistribute it.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>There is NO WARRANTY, to the extent permitted by law.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您要使用的密钥类型：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA 和 RSA
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA 和 Elgamal
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>9&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（签名和加密） *默认*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>10&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>11&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>13&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> （14）卡中现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ &lt;span style="color:#a5d6ff">11&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ECC 密钥的可实现的功能： 签名（Sign） 认证（Certify） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>目前启用的功能： 签名（Sign） 认证（Certify）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>S&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 签名功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>A&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 身份验证功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>Q&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 已完成
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ s
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ECC 密钥的可实现的功能： 签名（Sign） 认证（Certify） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>目前启用的功能： 认证（Certify）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>S&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 签名功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>A&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 身份验证功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>Q&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 已完成
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ q
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您想要使用的椭圆曲线：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">25519&lt;/span> *默认*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">448&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-521
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-512
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>9&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> secp256k1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请设定这个密钥的有效期限。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#79c0ff">0&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥永不过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt; &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 天后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;w &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 周后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;m &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 月后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;y &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 年后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥的有效期限是？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥永远不会过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>这些内容正确吗？ &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>GnuPG 需要构建用户标识以辨认您的密钥。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>真实姓名： 何庆 Ching He
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>电子邮件地址： heqing@rool.me
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>注释：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您正在使用‘utf-8’字符集。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您选定了此用户标识：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> “何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;”
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>更改姓名（N）、注释（C）、电子邮件地址（E）或确定（O）/退出（Q）？ o
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>我们需要生成大量的随机字节。在质数生成期间做些其他操作（敲打键盘
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>、移动鼠标、读写硬盘之类的）将会是一个不错的主意；这会让随机数
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>发生器有更好的机会获得足够的熵。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg: 吊销证书已被存储为‘/home/qing/.gnupg/openpgp-revocs.d/05426E81010BD7E474010F590ACF9AD8D2A9937D.rev’
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>公钥和私钥已经生成并被签名。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pub ed25519 2025-12-12 &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>C&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 05426E81010BD7E474010F590ACF9AD8D2A9937D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uid 何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-5" class="outline-3">
&lt;h3 id="headline-5">
使用主密钥生成三个子密钥,分别为加密,签署,认证
&lt;/h3>
&lt;div id="outline-text-headline-5" class="outline-text-3">
&lt;div class="src src-bash">
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 23
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 24
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 25
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 26
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 27
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 28
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 29
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 30
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 31
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 32
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 33
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 34
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 35
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 36
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 37
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 38
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 39
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 40
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 41
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 42
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 43
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 44
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 45
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 46
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 47
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 48
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 49
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 50
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 51
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 52
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 53
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 54
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 55
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 56
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 57
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 58
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 59
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 60
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 61
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 62
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 63
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 64
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 65
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 66
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 67
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 68
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 69
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 70
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 71
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 72
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 73
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 74
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 75
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 76
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 77
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 78
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 79
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 80
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 81
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 82
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 83
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 84
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 85
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 86
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 87
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 88
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 89
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 90
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 91
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 92
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 93
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 94
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 95
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 96
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 97
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 98
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 99
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">100
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">101
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">102
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">103
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">104
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">105
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">106
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">107
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">108
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">109
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">110
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">111
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">112
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">113
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">114
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">115
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">116
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">117
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">118
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">119
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">120
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">121
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">122
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">123
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">124
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">125
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">126
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">127
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">128
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">129
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">130
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">131
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">132
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">133
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">134
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">135
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">136
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">137
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">138
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">139
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">140
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">141
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">142
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">143
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">144
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">145
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">146
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">147
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">148
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">149
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">150
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">151
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">152
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">153
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">154
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">155
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">156
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">157
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">158
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">159
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">160
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">161
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">162
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">163
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">164
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">165
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">166
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">167
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">168
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">169
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">170
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">171
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">172
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">173
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">174
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">175
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">176
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">177
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">178
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">179
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">180
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">181
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">182
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">183
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">184
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>gpg --expert --edit-key 05426E81010BD7E474010F590ACF9AD8D2A9937D  INT ✘  2m 39s   23:18:44 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>GnuPG&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 2.4.8; Copyright &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>C&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#a5d6ff">2025&lt;/span> g10 Code GmbH
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>This is free software: you are free to change and redistribute it.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>There is NO WARRANTY, to the extent permitted by law.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>私钥可用。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sec ed25519/0ACF9AD8D2A9937D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：C
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 信任度：绝对 有效性：绝对
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span> 绝对 &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>. 何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg&amp;gt; addkey
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您要使用的密钥类型：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ElGamal（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>10&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>11&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>12&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>13&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> （14）卡中现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ &lt;span style="color:#a5d6ff">10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您想要使用的椭圆曲线：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">25519&lt;/span> *默认*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">448&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-521
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-512
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>9&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> secp256k1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请设定这个密钥的有效期限。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#79c0ff">0&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥永不过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt; &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 天后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;w &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 周后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;m &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 月后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;y &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 年后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥的有效期限是？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥永远不会过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>这些内容正确吗？ &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>真的要创建吗？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>我们需要生成大量的随机字节。在质数生成期间做些其他操作（敲打键盘
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>、移动鼠标、读写硬盘之类的）将会是一个不错的主意；这会让随机数
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>发生器有更好的机会获得足够的熵。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sec ed25519/0ACF9AD8D2A9937D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：C
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 信任度：绝对 有效性：绝对
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb ed25519/A442A8BD5C05A571
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：S
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span> 绝对 &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>. 何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg&amp;gt; addkey
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您要使用的密钥类型：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ElGamal（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>10&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>11&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>12&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>13&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> （14）卡中现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ &lt;span style="color:#a5d6ff">12&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您想要使用的椭圆曲线：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">25519&lt;/span> *默认*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">448&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-521
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-512
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>9&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> secp256k1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请设定这个密钥的有效期限。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#79c0ff">0&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥永不过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt; &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 天后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;w &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 周后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;m &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 月后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;y &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 年后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥的有效期限是？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥永远不会过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>这些内容正确吗？ &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>真的要创建吗？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>我们需要生成大量的随机字节。在质数生成期间做些其他操作（敲打键盘
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>、移动鼠标、读写硬盘之类的）将会是一个不错的主意；这会让随机数
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>发生器有更好的机会获得足够的熵。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sec ed25519/0ACF9AD8D2A9937D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：C
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 信任度：绝对 有效性：绝对
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb ed25519/A442A8BD5C05A571
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：S
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb cv25519/33086EB02C3025AC
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：E
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span> 绝对 &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>. 何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg&amp;gt; addkey
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您要使用的密钥类型：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ElGamal（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> DSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> RSA（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>10&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于签名）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>11&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（自定义用途）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>12&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> ECC（仅用于加密）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>13&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> （14）卡中现有密钥
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ &lt;span style="color:#a5d6ff">11&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ECC 密钥的可实现的功能： 签名（Sign） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>目前启用的功能： 签名（Sign）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>S&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 签名功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>A&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 身份验证功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>Q&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 已完成
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ a
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ECC 密钥的可实现的功能： 签名（Sign） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>目前启用的功能： 签名（Sign） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>S&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 签名功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>A&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 身份验证功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>Q&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 已完成
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ s
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ECC 密钥的可实现的功能： 签名（Sign） 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>目前启用的功能： 身份验证（Authenticate）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>S&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 签名功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>A&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 身份验证功能开关
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>Q&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> 已完成
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？ q
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请选择您想要使用的椭圆曲线：
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">25519&lt;/span> *默认*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Curve &lt;span style="color:#a5d6ff">448&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>4&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>5&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> NIST P-521
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>6&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-256
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>7&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-384
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>8&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> Brainpool P-512
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>9&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> secp256k1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>您的选择是？
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>请设定这个密钥的有效期限。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#79c0ff">0&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥永不过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt; &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 天后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;w &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 周后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;m &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 月后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &amp;lt;n&amp;gt;y &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> 密钥在 n 年后过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥的有效期限是？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>密钥永远不会过期
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>这些内容正确吗？ &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>真的要创建吗？&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>y/N&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> y
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>我们需要生成大量的随机字节。在质数生成期间做些其他操作（敲打键盘
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>、移动鼠标、读写硬盘之类的）将会是一个不错的主意；这会让随机数
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>发生器有更好的机会获得足够的熵。
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sec ed25519/0ACF9AD8D2A9937D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：C
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 信任度：绝对 有效性：绝对
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb ed25519/A442A8BD5C05A571
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：S
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb cv25519/33086EB02C3025AC
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：E
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssb ed25519/124BCC07E4045BE6
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 创建于：2025-12-12 有效至：永不 可用于：A
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span> 绝对 &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>. 何庆 Ching He &amp;lt;heqing@rool.me&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg&amp;gt; save&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-6" class="outline-3">
&lt;h3 id="headline-6">
导出主密钥和公钥, 离线多地保存, 删除主密钥/公钥
&lt;/h3>
&lt;div id="outline-text-headline-6" class="outline-text-3">
&lt;div class="src src-bash">
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>gpg --export-secret-keys 0ACF9AD8D2A9937D &amp;gt; ./heqing@rool.me_full_keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg --export-secret-subkeys 0ACF9AD8D2A9937D &amp;gt; ./heqing@rool.me_subkeys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg --export 0ACF9AD8D2A9937D &amp;gt; ./heqing@rool.me_pub
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">#来个吊销密钥&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg --gen-revoke 0ACF9AD8D2A9937D &amp;gt; ./heqing@rool.me_revoke&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-7" class="outline-3">
&lt;h3 id="headline-7">
加密/解密的过程
&lt;/h3>
&lt;/div>
&lt;div id="outline-container-headline-8" class="outline-3">
&lt;h3 id="headline-8">
签署的过程
&lt;/h3>
&lt;/div>
&lt;div id="outline-container-headline-9" class="outline-3">
&lt;h3 id="headline-9">
加密+签署
&lt;/h3>
&lt;/div>
&lt;div id="outline-container-headline-10" class="outline-3">
&lt;h3 id="headline-10">
认证的使用办法(ssh)
&lt;/h3>
&lt;div id="outline-text-headline-10" class="outline-text-3">
&lt;p>下面的操作其实有点不合适和优雅, 我选择用gpg的认证子密钥来进行ssh认证, 但是并不想用gpg-agent来认证,我这里采用1password-agent来进行认证
因为我平常用1password, 这样认证会更精细, 但是1password不支持gpg进行ssh认证, 于是我就需要用工具转换一下, 以前有一个monkeysphere的包,里面有openpgp2ssh的python工具.
但是已经失效. 这里采用go写的一个库&lt;/p>
&lt;div class="src src-bash">
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">23
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>git clone git@github.com:pinpox/pgp2ssh.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd pgp2ssh
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>go build
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>gpg --export-secret-subkeys --armor 0ACF9AD8D2A9937D &amp;gt; priv-gpg
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>./pgp2ssh  ✔  08:53:11 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:12 Enter path to private PGP key &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>default: ./priv.asc&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>priv-gpg
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 Keys:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> 0ACF9AD8D2A9937D &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>primary&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> A442A8BD5C05A571 &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>subkey&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>2&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> 33086EB02C3025AC &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>subkey&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> 124BCC07E4045BE6 &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>subkey&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:18 Choose key by index &lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>default: 0&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:24 Continuing with key &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>3&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> 124BCC07E4045BE6
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:24 Please enter passphrase to decrypt PGP key:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:34 private key type: *eddsa.PrivateKey
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:34 public key type: eddsa.PublicKey
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:34 public SSH key:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOxYfIXQOaudQAQH63UkKIM2gTQl1TbBJ5pJvOhl3l2x
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025/12/13 08:53:34 Private SSH key:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-----BEGIN OPENSSH PRIVATE KEY-----&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-11" class="outline-3">
&lt;h3 id="headline-11">
配合yubikey使用
&lt;/h3>
&lt;/div>
&lt;/div>
&lt;/div></description></item><item><title>关于</title><link>https://www.rool.me/about/</link><pubDate>Mon, 28 Aug 2017 08:48:38 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/about/</guid><description>&lt;p>
Hi I&amp;#39;m Rool and this is my website. I am a developer, writer and family man. I like sports, nature and travel. On this websites you can find everything I love. Enjoy!&lt;/p></description></item><item><title>全站启用https达到ssllabs的A+标准</title><link>https://www.rool.me/post/enable-https-ssllabs-a-plus/</link><pubDate>Wed, 23 Aug 2017 22:49:10 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/enable-https-ssllabs-a-plus/</guid><description>&lt;p>
经过努力, 使用本站达到了ssllabs的A+标准&lt;/p>
&lt;div id="outline-container-headline-1" class="outline-2">
&lt;h2 id="headline-1">
证书获取
&lt;/h2>
&lt;div id="outline-text-headline-1" class="outline-text-2">
&lt;p>正式使用Letsencrypt获取.&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-2" class="outline-2">
&lt;h2 id="headline-2">
nginx配置关键点
&lt;/h2>
&lt;div id="outline-text-headline-2" class="outline-text-2">
&lt;div class="src src-text">
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">23
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">24
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">25
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">26
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">27
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>server {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> listen 80;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> server_name blog.rool.me;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> return 301 https://$server_name$request_uri;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>server {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> listen 443 ssl http2;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> server_name blog.rool.me;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl on;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_prefer_server_ciphers on;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_certificate /usr/local/etc/letsencrypt/live/blog.rool.me/fullchain.pem;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_certificate_key /usr/local/etc/letsencrypt/live/blog.rool.me/privkey.pem;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # openssl dhparam -out dh4096.pem 4096 生成dh4096.pem
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_dhparam /usr/local/etc/letsencrypt/dh4096.pem;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_stapling on;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_stapling_verify on;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_ciphers &amp;#39;EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_session_cache shared:TLS:2m;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_session_timeout 10m;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> add_header Strict-Transport-Security &amp;#39;max-age=63072000; includeSubDomains&amp;#39;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location / {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> root /usr/local/www/blog.rool.me;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> index index.html index.htm;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-3" class="outline-3">
&lt;h3 id="headline-3">
ssl_prefre_server_ciphers on
&lt;/h3>
&lt;div id="outline-text-headline-3" class="outline-text-3">
&lt;p>协商证书的时候, 以服务器的标准为优先, 避免使用客户端的不安全的协商.&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-4" class="outline-3">
&lt;h3 id="headline-4">
ssl_dhparam
&lt;/h3>
&lt;div id="outline-text-headline-4" class="outline-text-3">
&lt;p>nginx默认使用1024进行交换, 这里用4096&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-5" class="outline-3">
&lt;h3 id="headline-5">
oscp开启
&lt;/h3>
&lt;div id="outline-text-headline-5" class="outline-text-3">
&lt;p>ssl_stapling ssl_stapling_verify&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-6" class="outline-3">
&lt;h3 id="headline-6">
ssl_siphers
&lt;/h3>
&lt;div id="outline-text-headline-6" class="outline-text-3">
&lt;p>这里选择mozilla推荐的设置,安全强度高,最新的推荐可查看Mozilla的官方文档&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-7" class="outline-3">
&lt;h3 id="headline-7">
add_header加入hsts
&lt;/h3>
&lt;div id="outline-text-headline-7" class="outline-text-3">
&lt;p>可以一定程度防止证书欺骗, 最好是加入浏览器的hsts列表, 但是有很多条件, 比如全站必须开启https,http都指向https,header有效期必须一年,加入Preload等..&lt;/p>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-8" class="outline-2">
&lt;h2 id="headline-8">
结果
&lt;/h2>
&lt;div id="outline-text-headline-8" class="outline-text-2">
&lt;p>最后本站获得了ssllab评分为A+, 如果不启用hsts最多只能获得A&lt;/p>
&lt;/div>
&lt;/div></description></item><item><title>博客以及其他服务迁移至gcloud</title><link>https://www.rool.me/post/%E5%8D%9A%E5%AE%A2%E4%BB%A5%E5%8F%8A%E5%85%B6%E4%BB%96%E6%9C%8D%E5%8A%A1%E8%BF%81%E7%A7%BB%E8%87%B3gcloud/</link><pubDate>Wed, 23 Aug 2017 22:39:56 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E5%8D%9A%E5%AE%A2%E4%BB%A5%E5%8F%8A%E5%85%B6%E4%BB%96%E6%9C%8D%E5%8A%A1%E8%BF%81%E7%A7%BB%E8%87%B3gcloud/</guid><description>&lt;p>
迁移了一些服务到gcloud, 不再使用一些免费的服务&lt;/p>
&lt;div id="outline-container-headline-1" class="outline-2">
&lt;h2 id="headline-1">
迁移了以下服务至gcloud
&lt;/h2>
&lt;div id="outline-text-headline-1" class="outline-text-2">
&lt;div id="outline-container-headline-2" class="outline-3">
&lt;h3 id="headline-2">
dns
&lt;/h3>
&lt;div id="outline-text-headline-2" class="outline-text-3">
&lt;p>原来使用dnspod, 出现过letsencrypt不能解析导致ssl证书不能获取,然后迁移至cloudxns
现在由于cloudxns不支持caa记录,再加上想装B把dns服务器名称换成自己的,就在gcloud上用powerdns搭建了一个dns服务器.
&amp;lt;!–more–&amp;gt;&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-3" class="outline-3">
&lt;h3 id="headline-3">
hugo生成的博客
&lt;/h3>
&lt;div id="outline-text-headline-3" class="outline-text-3">
&lt;p>以前托管在国内的coding,可惜现在coding如果不是金牌会员就会出现一个强制的过度页面…,然后促使我迁移到gcloud,同时换了一个主题.&lt;/p>
&lt;/div>
&lt;/div>
&lt;div id="outline-container-headline-4" class="outline-3">
&lt;h3 id="headline-4">
email
&lt;/h3>
&lt;div id="outline-text-headline-4" class="outline-text-3">
&lt;p>计划迁移email,不过工程量比较大,而且和网易的稳定性不一定更好, 暂时停止迁移.&lt;/p>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div></description></item><item><title>dns由he.net转移至dnspod国际版</title><link>https://www.rool.me/post/dns%E7%94%B1he.net%E8%BD%AC%E7%A7%BB%E8%87%B3dnspod%E5%9B%BD%E9%99%85%E7%89%88/</link><pubDate>Wed, 13 Apr 2016 11:27:57 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/dns%E7%94%B1he.net%E8%BD%AC%E7%A7%BB%E8%87%B3dnspod%E5%9B%BD%E9%99%85%E7%89%88/</guid><description>&lt;p>最近he.net老是抽风,换回dnspod,dnspod国际版应该能避免以前出现的国外不能访问的情况,dns服务器在香港&lt;/p></description></item><item><title>杜娅要请我吃羊肉汤</title><link>https://www.rool.me/post/%E6%9D%9C%E5%A8%85%E8%A6%81%E8%AF%B7%E6%88%91%E5%90%83%E7%BE%8A%E8%82%89%E6%B1%A4/</link><pubDate>Thu, 03 Dec 2015 10:36:44 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E6%9D%9C%E5%A8%85%E8%A6%81%E8%AF%B7%E6%88%91%E5%90%83%E7%BE%8A%E8%82%89%E6%B1%A4/</guid><description>&lt;p>上周周末,他们打麻将,我去外面吃饭的时候,杜娅的狗狗居然跑到我床上尿尿,回来才发现.
于是,杜娅决定请我吃羊肉汤,补偿我,以此博客作为记录凭证.&lt;/p></description></item><item><title>使用lent'sEncrypt的SSL</title><link>https://www.rool.me/post/%E4%BD%BF%E7%94%A8letsencrypt%E7%9A%84ssl/</link><pubDate>Sat, 14 Nov 2015 11:43:53 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E4%BD%BF%E7%94%A8letsencrypt%E7%9A%84ssl/</guid><description>&lt;h2 id="可用的免费ssl">可用的免费ssl&lt;/h2>
&lt;ol>
&lt;li>startssl
我前一个使用的,免费一年,一年后续签,class1只能用于单独的二级域名,startssl被很多浏览器信任,很不错.&lt;/li>
&lt;li>国内的wisign
传说中是前一个的二级分销?也提供免费一年的,由于界面是中文的,所以操作方便很多,不过由于已经使用的startssl,所以没有用过.&lt;/li>
&lt;li>最近开始的Let&amp;rsquo;s Encrypt.
Let&amp;rsquo;s Encrypt 项目是由互联网安全研究小组（ISRG，Internet Security Research Group）主导并开发的一个新型数字证书认证机构（CA，Certificate Authority）。2015-11-16会开始开放使用,会员有很多大牌公司,感觉有保证,自动续签,一整套的签发工具,就用这个了..&lt;/li>
&lt;/ol></description></item><item><title>hugo主题修改</title><link>https://www.rool.me/post/hugo%E4%B8%BB%E9%A2%98%E4%BF%AE%E6%94%B9/</link><pubDate>Mon, 02 Nov 2015 16:29:33 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/hugo%E4%B8%BB%E9%A2%98%E4%BF%AE%E6%94%B9/</guid><description>&lt;p>hugo虽然有很多的主题可以选择,不过大多都不能直接使用,借鉴了很多的其他人的Hugo的主题:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="http://blog.coderzh.com/">coderzh&lt;/a>技术牛人的博客&lt;/li>
&lt;li>&lt;a href="http://www.chingli.com/">青砾&lt;/a>清新,干净,极简&lt;/li>
&lt;li>&lt;a href="http://nanshu.wang/">Nanshu Wang&lt;/a>一个程序媛的博客,主要借鉴了hugo的开发者spf13的主题&lt;/li>
&lt;li>&lt;a href="https://gohugo.io/">hugo官网&lt;/a>虽然很多英文,但是真要修改主题,这里才是帮助最多的地方
最后修改后的代码都放在我的&lt;a href="https://github.com/roolcz">github&lt;/a>上面,有需要借鉴的可以直接去clone&lt;/li>
&lt;/ul>
&lt;h2 id="我的需求">我的需求&lt;/h2>
&lt;ul>
&lt;li>nav导航我想按照categories来生成&lt;/li>
&lt;li>文章显示关联的tags&lt;/li>
&lt;li>有tags标签云&lt;/li>
&lt;li>单个文章在需要的时候显示toc目录&lt;/li>
&lt;/ul>
&lt;h2 id="选择一款基础的主题">选择一款基础的主题&lt;/h2>
&lt;p>hugo官网的主题,有很多,但是,很多主题是有bug的,不能直接拿来使用,而且安装的时候,必须好好查看每个主题的说明,要不然会出问题&lt;/p>
&lt;h3 id="beghyde之间的纠结">beg,hyde之间的纠结&lt;/h3>
&lt;p>外观上面,我第一时间觉得hyde更OK,极度精简,和谐,beg看起来的更传统一点,没什么新意,看起来容易疲劳的感觉,但是默认的时候hyde的分类没有beg那么明显,因为要在选择主题的基础上修改,所以就选择了beg.&lt;/p>
&lt;h3 id="beg的问题">beg的问题&lt;/h3>
&lt;p>刚安装好beg,然后发现了几个问题:&lt;/p>
&lt;h4 id="beg显示tags分类的url有问题">beg显示tags分类的url有问题&lt;/h4>
&lt;p>调试的时候,&lt;a href="http://localhost:1313/tags/">http://localhost:1313/tags/&lt;/a>里面点击开对应tag的链接,发现显示的url是&lt;code>http://localhost:1313/tags/tags/key&lt;/code>,多了一个tags,导致404错误.&lt;/p>
&lt;h4 id="官网上beg的配置介绍用的yaml">官网上beg的配置介绍用的yaml&lt;/h4>
&lt;p>虽然yaml和toml我都不熟悉,但是我就是想用toml.&lt;/p>
&lt;h2 id="修改主题的细节">修改主题的细节&lt;/h2>
&lt;h3 id="修改的办法">修改的办法&lt;/h3>
&lt;p>beg主题安装在&lt;code>themes/beg&lt;/code>文件夹下面,修改的时候,最好不要直接修改这个文件夹,而是把对应的文件拷贝的工作目录里面去,用Hugo命令生成文件的时候,会覆盖themes文件夹下面的文件.&lt;/p>
&lt;h4 id="例子">例子&lt;/h4>
&lt;p>前面不是说,beg的tags分类url有问题么,查了后发现,是受&lt;code>themes/beg/layout/_default/terms.html&lt;/code>控制,首先拷贝要编辑的文件:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>mkdir -p layout/_default
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cp themes/beg/layout/_default/terms.html layout/_default/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>然后编辑文件&lt;code>layout/_default/terms.html&lt;/code>,我这边只改了一小段:&lt;code>href=&amp;quot;{{ $data.Plural }}&lt;/code> &amp;ndash;&amp;raquo; &lt;code>href=&amp;quot;/{{ $data.Plural }}&lt;/code>;就是多加了一个&lt;code>/&lt;/code>.重新运行本地调试环境:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>hugo server --theme&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>beg --buildDrafts --watch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>可以找到tags的标签URL已经对了.&lt;/p>
&lt;h3 id="根据主题编辑站点配置文件configtoml">根据主题编辑站点配置文件config.toml&lt;/h3>
&lt;p>每个主题需要设置的变量和变量名字都不一样,所以一定要根据主题的介绍来设置.beg默认的介绍是用config.yaml,我这不转成toml文件,hugo都认可.:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">23
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">24
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-toml" data-lang="toml">&lt;span style="display:flex;">&lt;span>BaseUrl = &lt;span style="color:#a5d6ff">&amp;#34;http://blog.rool.me&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>LanguageCode = &lt;span style="color:#a5d6ff">&amp;#34;zh-CN&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Title = &lt;span style="color:#a5d6ff">&amp;#34;rool&amp;#39;s blog&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>DisablePathToLower = &lt;span style="color:#79c0ff">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MetadataFormat = &lt;span style="color:#a5d6ff">&amp;#34;toml&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Theme = &lt;span style="color:#a5d6ff">&amp;#39;beg&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>paginate = &lt;span style="color:#a5d6ff">10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[permalinks]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> post = &lt;span style="color:#a5d6ff">&amp;#34;/:year/:month/:day/:title/&amp;#34;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># 保留日期和标题的同时,尽量的短.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[Indexes]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> tag = &lt;span style="color:#a5d6ff">&amp;#34;tags&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> categorie = &lt;span style="color:#a5d6ff">&amp;#34;categories&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[Params]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Author = &lt;span style="color:#a5d6ff">&amp;#34;rool&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> DateForm = &lt;span style="color:#a5d6ff">&amp;#34;2006-01-02 15:04:05&amp;#34;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># go语言的时间格式设置有点有趣的就是这个,用的2006-01-02这个特殊时间来设置,时分秒都要一样哦.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> GoogleAnalyticsUserID = &lt;span style="color:#a5d6ff">&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Facebook = &lt;span style="color:#a5d6ff">&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Twitter = &lt;span style="color:#a5d6ff">&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Github = &lt;span style="color:#a5d6ff">&amp;#34;roolcz&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ShowRelatedPost = &lt;span style="color:#79c0ff">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8b949e;font-style:italic">#Disqus = &amp;#34;unresolved&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Duoshuo = &lt;span style="color:#a5d6ff">&amp;#34;rool&amp;#34;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># 我这里用的国内的多说,毕竟国内用qq的比较多一点.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> SyntaxHighlightTheme = &lt;span style="color:#a5d6ff">&amp;#34;github.min.css&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="修改header按照categories显示">修改header,按照categories显示&lt;/h3>
&lt;p>参考官网的教程&lt;a href="https://gohugo.io/taxonomies/overview/">taxonomies&lt;/a>来设置.
主要是侧栏也有tags,这个和导航条上面的tags功能重复了,所以我选择导航条上用categories,因为categories我一般只有三个类型&lt;code>技术&lt;/code>,&lt;code>思绪&lt;/code>,&lt;code>生活&lt;/code>,而按照我的习惯,一般的tags,一个文章可能会写上十几个&amp;hellip;
文件是&lt;code>layout&lt;/code>下面的&lt;code>partials/default_head.html&lt;/code>
默认的导航条是写了&lt;code>tags/&lt;/code>这个url,但是我要用categories来生成,所以有了以下代码:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>{{ $baseurl := .Site.BaseURL }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ range $key, $value := .Site.Taxonomies.categories.ByCount }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;lt;li&amp;gt;&amp;lt;a href=&amp;#34;{{ $baseurl }}/categories/{{ $value.Name }}&amp;#34;&amp;gt;{{ $value.Name }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ end }}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="修改侧栏的tags显示为标签云tagcanvas">修改侧栏的tags显示为标签云(tagcanvas)&lt;/h3>
&lt;p>等我加上一些文章上去后,发现tags的默认列表就已经很长了,几十个tags列出来,相信是很乱的,于是就决定把tags显示改成标签云,这样就在页面上的展示就不会太长.
文件是&lt;code>partials/sidebar.html&lt;/code>&lt;/p>
&lt;h4 id="tagcanvas介绍">tagcanvas介绍&lt;/h4>
&lt;p>一个用html5的canvas功能和js实现的标签云.功能很多,有很多定制的.&lt;/p>
&lt;h4 id="下载tagcanvas">下载tagcanvas&lt;/h4>
&lt;p>tagcanvas有jquery版本的,但是引入jquery可能会和原来的主题冲突,所以我用标准javascript版本的,也不容易冲突.
去&lt;a href="http://www.goat1000.com/tagcanvas.php">tagcanvas官网&lt;/a>下载&lt;code>tagcanvas.min.js&lt;/code>放入本地的&lt;code>static/js&lt;/code>目录&lt;/p>
&lt;h4 id="替换原来sidebar的tags">替换原来sidebar的tags&lt;/h4>
&lt;p>文件内容主要如下&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">22
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">23
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">24
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">25
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">26
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">27
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">28
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">29
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">30
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">31
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>div &lt;span style="color:#ff7b72">class&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;list-group&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>script src&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ .Site.BaseURL }}/js/tagcanvas.min.js&amp;#34;&lt;/span> type&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;text/javascript&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&amp;lt;&lt;/span>&lt;span style="color:#f85149">/script&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>div id&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;myCanvasContainer&amp;#34;&lt;/span> style&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;text-align:center;&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>canvas width&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;250&amp;#34;&lt;/span> height&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;250&amp;#34;&lt;/span> id&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;myCanvas&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>ul&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ $baseurl &lt;span style="color:#ff7b72;font-weight:bold">:=&lt;/span> .Site.BaseURL }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ range $key, $value &lt;span style="color:#ff7b72;font-weight:bold">:=&lt;/span> .Site.Taxonomies.tags.ByCount }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>li&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&amp;lt;&lt;/span>a href&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ $baseurl }}/tags/{{ $value.Name | urlize }}&amp;#34;&lt;/span> data&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>weight&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ add 15 (add (mod $key 2) (mod $value.Count 50)) }}&amp;#34;&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>{{ $value.Name }}&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ end }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/canvas&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/ul&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/div&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>script type&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;text/javascript&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">var&lt;/span> gradient &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> { &lt;span style="color:#a5d6ff">0&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">:&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;#f00&amp;#34;&lt;/span>, &lt;span style="color:#a5d6ff">1&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">:&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;#00f&amp;#34;&lt;/span> } &lt;span style="color:#8b949e;font-style:italic">//颜色由红到蓝
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">//页面载人完成后开始画图,显示标签云
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>window.onload &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#ff7b72">function&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.maxSpeed &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">0.01&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.reverse &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#79c0ff">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.initial &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> [&lt;span style="color:#a5d6ff">0&lt;/span>,&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>&lt;span style="color:#a5d6ff">0.1&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.outlineColour &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;#f96&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.outlineThickness &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">2&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.wheelZoom &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#79c0ff">false&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.weight &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#79c0ff">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.weightMode &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;both&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.weightFrom &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;data-weight&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.weightGradient &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> gradient;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>TagCanvas.Start(&lt;span style="color:#a5d6ff">&amp;#39;myCanvas&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/script&amp;gt; &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/div&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/div&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>每个参数的相信作用最好去官网看,这边我主要是定制了显示的颜色,初始转动的方向,加上自动设置权重(主要按照tag的数量,以及其他的.),不允许客户端缩放(因为缩放后显示效果差.不协调)&lt;/p>
&lt;h3 id="添加文章的内容导航目录">添加文章的内容导航目录&lt;/h3>
&lt;p>hugo默认用变量&lt;code>{{ .TableOfContents }}&lt;/code>来显示目录的内容,目录层次主要是一句markdown的主题标签和列表等.&lt;/p>
&lt;h4 id="在_defaultsinglehtml文件中添加目录内容">在&lt;code>_default/single.html&lt;/code>文件中添加目录内容&lt;/h4>
&lt;p>我计划是放在右边的sidebar下面&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">6
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>&amp;lt;div class=&amp;#34;col-md-4&amp;#34;&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ partial &amp;#34;sidebar.html&amp;#34; . }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;lt;/div&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;lt;div id=&amp;#34;toc&amp;#34; class=&amp;#34;col-md-4&amp;#34; style=&amp;#34;position:fixed;right:0;top:1500px;&amp;#34;&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ .TableOfContents }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;lt;/div&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h4 id="用js设定目录的位置">用js设定目录的位置&lt;/h4>
&lt;p>当文章内容少的时候,没有看目录导航的需要,当文章内容多的时候,又最好能在右边一直都显示目录,这样更人性化一点,所以我需要设定当sidebar的标签云在浏览器界面top下出现的时候,目录紧跟着其下方,当sidebar的标签云在浏览器界面top以上的时候,目录能一直固定在浏览器界面的右上方.问了同事,发现css不好实现,用js比较好,&lt;/p>
&lt;p>需要用js检查浏览器界面滚动的事件,然后算出标签云下边到浏览器上边的位置,如果为负数,就要固定在浏览器右上边,这里检测滚动用window.onscroll,具体代码如下:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">19
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">20
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">21
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>div id&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;toc&amp;#34;&lt;/span> &lt;span style="color:#ff7b72">class&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;col-md-4&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ .TableOfContents }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/div&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>script type&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;text/javascript&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">//检查浏览器窗口的滚动事件.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>window.onscroll &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#ff7b72">function&lt;/span>(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">var&lt;/span> toc &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> document.getElementById(&lt;span style="color:#a5d6ff">&amp;#34;toc&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">var&lt;/span> tag &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> document.getElementById(&lt;span style="color:#a5d6ff">&amp;#34;myCanvasContainer&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">// 取得标签云的下边界到浏览器界面的上边界的距离
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>h &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> tag.getBoundingClientRect().bottom;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">// 小于的时候,直接固定到离浏览器上边界20px处.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>&lt;span style="color:#ff7b72">if&lt;/span> (h &lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span> &lt;span style="color:#a5d6ff">0&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> toc.style.position &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;fixed&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> toc.style.right &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;27px&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> toc.style.top &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;20px&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> toc.style.width &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;390px&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }&lt;span style="color:#ff7b72">else&lt;/span>{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> toc.style.position &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;static&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/script&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="添加多说评论系统">添加多说评论系统&lt;/h3>
&lt;p>这个好办,去多说官网注册,设定好后,把代码加入模板就好.&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 6
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 7
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 8
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679"> 9
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">10
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">11
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">12
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">13
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">14
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">15
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">16
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">17
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">18
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>{{ &lt;span style="color:#ff7b72">if&lt;/span> isset .Site.Params &lt;span style="color:#a5d6ff">&amp;#34;Duoshuo&amp;#34;&lt;/span> }}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&amp;lt;!--&lt;/span> 多说评论框 start &lt;span style="color:#ff7b72;font-weight:bold">--&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>div &lt;span style="color:#ff7b72">class&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;ds-thread&amp;#34;&lt;/span> data&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>thread&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>key&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ .RelPermalink }}&amp;#34;&lt;/span> data&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>title&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ .Title }}&amp;#34;&lt;/span> data&lt;span style="color:#ff7b72;font-weight:bold">-&lt;/span>url&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ .Permalink }}&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&amp;lt;&lt;/span>&lt;span style="color:#f85149">/div&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&amp;lt;!--&lt;/span> 多说评论框 end &lt;span style="color:#ff7b72;font-weight:bold">--&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&amp;lt;!--&lt;/span> 多说公共JS代码 start (一个网页只需插入一次) &lt;span style="color:#ff7b72;font-weight:bold">--&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>script type&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;text/javascript&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">var&lt;/span> duoshuoQuery &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> {short_name&lt;span style="color:#ff7b72;font-weight:bold">:&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;{{ .Site.Params.Duoshuo }}&amp;#34;&lt;/span>};
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(&lt;span style="color:#ff7b72">function&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">var&lt;/span> ds &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> document.createElement(&lt;span style="color:#a5d6ff">&amp;#39;script&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ds.type &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;text/javascript&amp;#39;&lt;/span>;ds.&lt;span style="color:#ff7b72">async&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#79c0ff">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ds.src &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> (document.location.protocol &lt;span style="color:#ff7b72;font-weight:bold">==&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;https:&amp;#39;&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">?&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;https:&amp;#39;&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">:&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;http:&amp;#39;&lt;/span>) &lt;span style="color:#ff7b72;font-weight:bold">+&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;//static.duoshuo.com/embed.js&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ds.charset &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;UTF-8&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(document.getElementsByTagName(&lt;span style="color:#a5d6ff">&amp;#39;head&amp;#39;&lt;/span>)[&lt;span style="color:#a5d6ff">0&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">||&lt;/span> document.getElementsByTagName(&lt;span style="color:#a5d6ff">&amp;#39;body&amp;#39;&lt;/span>)[&lt;span style="color:#a5d6ff">0&lt;/span>]).appendChild(ds);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>})();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#f85149">/script&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&amp;lt;!--&lt;/span> 多说公共JS代码 end &lt;span style="color:#ff7b72;font-weight:bold">--&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{{ end }}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>这个多说里面的&lt;code>data-thread-key&lt;/code>是自己定义的,主要用来区分哪些评论属于哪个文章,我这直接用相对url来代替.&lt;/p></description></item><item><title>开始买房</title><link>https://www.rool.me/post/%E5%BC%80%E5%A7%8B%E4%B9%B0%E6%88%BF/</link><pubDate>Fri, 30 Oct 2015 20:37:51 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E5%BC%80%E5%A7%8B%E4%B9%B0%E6%88%BF/</guid><description>&lt;h2 id="第一次买房">第一次买房&lt;/h2>
&lt;p>选中了成都双流的万锦城项目,原因一个是便宜,二个空间大,115平米套四,朝向还行,缺点就是周围配套不全,现在基本都是农田的感觉.&lt;/p></description></item><item><title>使用hugo生成博客</title><link>https://www.rool.me/post/%E4%BD%BF%E7%94%A8hugo%E7%94%9F%E6%88%90%E5%8D%9A%E5%AE%A2/</link><pubDate>Thu, 29 Oct 2015 14:10:02 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E4%BD%BF%E7%94%A8hugo%E7%94%9F%E6%88%90%E5%8D%9A%E5%AE%A2/</guid><description>&lt;h2 id="选择hugo">选择hugo&lt;/h2>
&lt;p>以前使用aws的ec2,搭建wordpress,放置博客,php比较耗内存,还需要一个数据库,偶然之间看见了静态博客的文章,就萌生了迁移到静态博客的想法,主要由以下原因:&lt;/p>
&lt;ul>
&lt;li>个人博客,完全不需要用户管理等一大堆的东西,所以理论上其实是不需要数据库的.&lt;/li>
&lt;li>迁移方便,纯静态的,设置只需要一个nginx就行了&lt;/li>
&lt;li>专注于写作,本地使用自己喜欢的编辑器,改完后,push到远程仓库上面去就行了.&lt;/li>
&lt;li>对比了其他的,包括pelican,octopress,然后单纯的因为hugo开发环境更方便搭建,选择了hugo.&lt;/li>
&lt;/ul>
&lt;p>&lt;a href="https://gohugo.io/">Hugo主页&lt;/a>很漂亮,在官网可以查到很多文档,虽然大部分是英文,但是很详细.&lt;/p>
&lt;h2 id="开发环境搭建">开发环境搭建&lt;/h2>
&lt;p>用的最多的操作系统是OS X和debian,笔记本用的OS X最多,使用的服务器都用的debian,我计划调试的时候用笔记本,这样在什么地方都能写,最后用debian生成最后的部署文件.&lt;/p>
&lt;h3 id="os-x系统">OS X系统&lt;/h3>
&lt;p>OS X下面的安装非常的方便,(假设已经安装好了brew,因为对于苹果下面的开发者来说,真的是非常有必要的一个东西.):&lt;/p>
&lt;p>&lt;code>brew install hugo&lt;/code>&lt;/p>
&lt;h3 id="debian系统">debian系统&lt;/h3>
&lt;p>debian下面的安装,在github的hugo项目下载已经编译好的二进制程序,点&lt;a href="https://github.com/spf13/hugo/releases">这里&lt;/a>:&lt;/p>
&lt;p>&lt;code>sudo dpkg -i hugo_0.14_amd64.deb&lt;/code>&lt;/p>
&lt;h2 id="配置hugo">配置hugo&lt;/h2>
&lt;h3 id="新建站点">新建站点&lt;/h3>
&lt;p>比较简单,一句话搞定
&lt;code>hugo new site path/to/site&lt;/code>&lt;/p>
&lt;p>这个会在&lt;code>path/to/site&lt;/code>目录下面建立一些必要的文件和目录结构.&lt;/p>
&lt;h3 id="新建页面">新建页面&lt;/h3>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>cd /path/to/site
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>hugo new about.md
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>会新建一个文件在&lt;code>content&lt;/code>文件夹下面:&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">3
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">4
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">5
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">6
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>+++
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>date = &amp;#34;2015-01-08T08:36:54-07:00&amp;#34;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>draft = true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>title = &amp;#34;about&amp;#34;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>+++
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="安装主题">安装主题&lt;/h3>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>git clone --recursive https://github.com/spf13/hugoThemes themes
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="使用主题测试">使用主题,测试&lt;/h3>
&lt;p>&lt;code>hugo server --theme=hyde --buildDrafts --watch&lt;/code>&lt;/p>
&lt;p>这个会用hyde主题来启动,并且测试,在浏览器打开&lt;a href="http://127.0.0.1:1313/">http://127.0.0.1:1313/&lt;/a>就可以看见效果,&lt;code>--watch&lt;/code>选项主要是为了使content发生改变的时候,实时改变效果.&lt;/p>
&lt;h3 id="生成部署">生成部署&lt;/h3>
&lt;p>&lt;code>hugo --theme=hyde&lt;/code>&lt;/p>
&lt;p>生成的最后文件在public里面,直接把整个文件夹copy或者rsync到需要部署的地方去就行.&lt;/p>
&lt;h3 id="配置">配置&lt;/h3>
&lt;p>&lt;code>config.toml&lt;/code>里面可以设置一些常用的,比如语言,作者,评论系统的id等.
&lt;code>static,layout&lt;/code>等里面可以放一些自定义的东西,来替换主题的内容.&lt;/p>
&lt;h2 id="托管github">托管github&lt;/h2>
&lt;p>注册github账号,新建git仓库,把刚才的&lt;code>path/to/site&lt;/code>作为内容提交上去.我这边的地址是:&lt;a href="https://github.com/roolcz/blog.rool.me">https://github.com/roolcz/blog.rool.me&lt;/a>&lt;/p>
&lt;h2 id="使用jenkins来作为webhook持续集成">使用jenkins来作为webhook持续集成.&lt;/h2>
&lt;p>因为jenkins我一直用来作为持续集成用,比较熟悉,刚好又看见github上面service里面刚好有针对jenkins的.&lt;/p>
&lt;h3 id="在免费ec2里面安装jenkins">在免费ec2里面安装jenkins&lt;/h3>
&lt;p>&lt;code>apt-get install jenkins &amp;amp;&amp;amp; service jenkins start&lt;/code>&lt;/p>
&lt;p>PS:jenkins如果使用nginx作为前端的话,最好按照jenkins的文档设定nginx的配置:
&lt;a href="https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Nginx">Running+Jenkins+behind+Nginx&lt;/a>&lt;/p>
&lt;h3 id="jenkins设定">jenkins设定&lt;/h3>
&lt;ol>
&lt;li>添加用户,打开认证,还有就是关闭注册&lt;/li>
&lt;li>添加&lt;code>GitHub plugin&lt;/code>插件&lt;/li>
&lt;li>添加job&lt;/li>
&lt;li>设定job&lt;/li>
&lt;/ol>
&lt;p>设定和github之间的关系,有两种方式,详细的就看&lt;code>GitHub plugin&lt;/code>插件的说明,我这里图省事,就选择最简单的办法.&lt;/p>
&lt;ul>
&lt;li>配置&lt;code>GitHub project&lt;/code>为你的项目在github网页上的访问地址&lt;/li>
&lt;li>源码配置里面设定&lt;code>git&lt;/code>,设定为项目的git地址和分支&lt;/li>
&lt;li>触发里面选中&lt;code>Build when a change is pushed to GitHub&lt;/code>&lt;/li>
&lt;li>构建里面添加&lt;code>Execute shell&lt;/code>,主要内容大致会是hugo命令生成站点以及push到github的page上面去.&lt;/li>
&lt;/ul>
&lt;h3 id="github设置">github设置&lt;/h3>
&lt;ul>
&lt;li>在项目的设置里面添加service(不是webhook),因为webhook的配置要麻烦些,可以认为service是已经配置好的webhook?&lt;/li>
&lt;li>service的名称选择&lt;code>Jenkins (GitHub plugin)&lt;/code>&lt;/li>
&lt;li>Jenkins hook url的内容就是刚刚安装的jenkins的url加上用户名和密码:
&lt;code>http://user:pwd@jenkins.domain:port/github-webhook/&lt;/code>
内容根据自己刚刚设置jenkins的时候的设置修改好.&lt;/li>
&lt;/ul>
&lt;h3 id="push改变到github">push改变到github&lt;/h3>
&lt;p>随便提交一个commit到github上去测试下jenkins执行job了没有.还可以看看各种状态.&lt;/p></description></item><item><title>本站dns由dnspod转移至he.net</title><link>https://www.rool.me/post/%E6%9C%AC%E7%AB%99dns%E7%94%B1dnspod%E8%BD%AC%E7%A7%BB%E8%87%B3he.net/</link><pubDate>Fri, 26 Dec 2014 20:33:38 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E6%9C%AC%E7%AB%99dns%E7%94%B1dnspod%E8%BD%AC%E7%A7%BB%E8%87%B3he.net/</guid><description>&lt;h2 id="发现问题">发现问题&lt;/h2>
&lt;ol>
&lt;li>发现paypal的邮件在rool.me收不到，查看了很多原因，优化了postfix，最后还是不能收到，原来是paypal的服务器查询不到rool.me的dns记录，估计dnspod在国外做的不好&lt;/li>
&lt;li>在公司连接本站的时候，经常出现连接不到地址的情况，ping rool.me一下，才发现没有dns记录，难道是dnspod在国内也抽风，虽然我用的是免费套餐，但是出了这个问题也难受。&lt;/li>
&lt;/ol>
&lt;h2 id="考虑迁移dns">考虑迁移dns&lt;/h2>
&lt;p>考察发现HE.NET在国外的评价挺好，故而决定转移dnspod至he.net&lt;/p>
&lt;h2 id="操作流程">操作流程&lt;/h2>
&lt;ol>
&lt;li>访问&lt;a href="https://dns.he.net/">https://dns.he.net&lt;/a>注册一个账号&lt;/li>
&lt;li>在he.net的面板里面添加好需要解析的域名，dns记录,ttl都设置成300(5分钟)。网页会提示ns记录不对，先忽略&lt;/li>
&lt;li>去godaddy设置ns记录到he.net，一共有五个ns1-ns5.he.net&lt;/li>
&lt;/ol>
&lt;h2 id="效果">效果&lt;/h2>
&lt;p>paypal的邮件能收到了，在公司访问dns也正常解析了&lt;/p>
&lt;h2 id="后续">后续&lt;/h2>
&lt;p>网页上提示ns1.he.net不支持ipv6，虽然我不用ipv6但是，网页一直有个提示，烦人，就把ns1去掉了，然后去godaddy上也把ns1的记录去掉&lt;/p></description></item><item><title>梦里依稀故人在</title><link>https://www.rool.me/post/%E6%A2%A6%E9%87%8C%E4%BE%9D%E7%A8%80%E6%95%85%E4%BA%BA%E5%9C%A8/</link><pubDate>Tue, 27 May 2014 20:31:35 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/%E6%A2%A6%E9%87%8C%E4%BE%9D%E7%A8%80%E6%95%85%E4%BA%BA%E5%9C%A8/</guid><description>&lt;p>蓦然梦里你依然在天天等我回去，关心孙子吃没吃饭，吃没吃肉，步履蹒跚却怕给人填麻烦一样不咋乐意让别人扶着，一日日雷打不动的去打麻将，都道你糊涂了，可到了你这年纪，需要那么认真干嘛，自己都要人照顾，你为什么还记得我啊，还想要帮我做这个做那个，回家就买肉，或许老人家的眼里面只有吃得好才是最幸福，能吃肉才最幸福，太晚没关灯也会过来催你睡觉，虽然后来年纪更大了，不能送我去车站，不能在班车上等车发动再离开，但是还是少不了好多好多的叮嘱，而且总是光正的思想，总是自己好好做事，做好自己就行了，从来没有那些个夺利倾轧的想法，都是先求己身。我为什么老是觉得你依然在那里 依然在等我回去 等大家回去啊 ，一定要等到梦醒了，想了好久才想到你不在了的事实。&lt;/p></description></item><item><title>ubuntu下搭建基于pptp的vpn服务器</title><link>https://www.rool.me/post/ubuntu%E4%B8%8B%E6%90%AD%E5%BB%BA%E5%9F%BA%E4%BA%8Epptp%E7%9A%84vpn%E6%9C%8D%E5%8A%A1%E5%99%A8/</link><pubDate>Tue, 14 Jan 2014 20:19:05 +0800</pubDate><author>heqing@rool.me (rool)</author><guid>https://www.rool.me/post/ubuntu%E4%B8%8B%E6%90%AD%E5%BB%BA%E5%9F%BA%E4%BA%8Epptp%E7%9A%84vpn%E6%9C%8D%E5%8A%A1%E5%99%A8/</guid><description>&lt;p>为了翻墙，在亚马逊的vps上搭建基于pptp的vpn服务器。系统环境：ubuntu12.04&lt;/p>
&lt;h2 id="安装pptp">安装pptp:&lt;/h2>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>apt-get update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apt-get -y install pptpd
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="设置pptp使用的ip和dns">设置pptp使用的ip和dns:&lt;/h2>
&lt;p>&lt;code>vim /etc/pptpd.conf&lt;/code>&lt;/p>
&lt;ul>
&lt;li>分配的ip设置
在文件末尾添加如下内容：&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>localip 10.10.10.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>remoteip 10.10.10.230-250
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>localip 是 VPN 服务器 IP，可任意指定。
remoteip 是可分配给 vpn 客户端 IP。
:wq保存退出vim&lt;/p>
&lt;ul>
&lt;li>dns设置:
编辑&lt;code>vim /etc/ppp/pptpd-options&lt;/code>
找到并编辑ms-dns,去掉注释&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>ms-dns 172.31.0.2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ms-dns 8.8.8.8
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>173.31.0.2是亚马逊内部的dns，8.8.8.8是google的dns&lt;/p>
&lt;h2 id="添加vpn用户">添加vpn用户&lt;/h2>
&lt;p>编辑:&lt;code>vim /etc/ppp/chap-secrets&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span># Secrets for authentication using CHAP
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span># client server secret IP addresses
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>vpn pptpd pwd *
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>用户名vpn，服务器名pptpd(保持和pptpd-optins里面的设置一样)，pwd密码，*是允许任何ip连接该服务器&lt;/p>
&lt;h2 id="iptables防火墙设置">iptables防火墙设置&lt;/h2>
&lt;ul>
&lt;li>开启ip转发
&lt;code>vim /etc/sysctl.conf&lt;/code>
找到net.ipv4.ip_forward去掉注释，并设置成1&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span># Uncomment the next line to enable packet forwarding for IPv4
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>net.ipv4.ip_forward=1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>生效设置:&lt;code>sysctl -p&lt;/code>&lt;/p>
&lt;h2 id="设置-iptables-nat-转发">设置 iptables NAT 转发&lt;/h2>
&lt;p>&lt;code>iptables -t nat -A POSTROUTING -s 10.10.10.0/8 -o eth0 -j MASQUERADE&lt;/code>&lt;/p>
&lt;p>10.10.10.0/8是根据第二步设置的ip地址范围设置的。
如果要开机生效，可以把上面两行iptables命令写入/etc/rc.local的exit 0 前面：&lt;/p>
&lt;div class="highlight">&lt;div style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
&lt;table style="border-spacing:0;padding:0;margin:0;border:0;">&lt;tr>&lt;td style="vertical-align:top;padding:0;margin:0;border:0;">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">1
&lt;/span>&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>iptables -t nat -A POSTROUTING -s 10.10.10.0/8 -o eth0 -j MASQUERADE
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>exit 0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="启动pptp服务">启动pptp服务：&lt;/h2>
&lt;p>&lt;code>/etc/init.d/pptpd start&lt;/code>&lt;/p></description></item></channel></rss>