惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
罗磊的独立博客
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
D
DataBreaches.Net
博客园 - 叶小钗
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
B
Blog
V
Visual Studio Blog
雷峰网
雷峰网
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Mr. Will

Teaching AI When to Stay Silent 不会翻译的话,其实可以不翻译的 Announcing The Vernal Fortnightly 2025 年终总结 Tailwind as a Headwind My Home Page, Reimagined Kickstarting a New Mac Refining My Domain Email 2024:浏览器从 A 到 Z 数模转换:微喷打印影像输出! “严谨”的混乱——数学 2023 年度总结 这不过是个开场 Hello, Tags, Categories, LaTeX and Rainbow! About Comments GitHub's Own Dark Mode! Theme Cupertino is Updated From Now on, I Can't Respond on Weekdays Apple Newsroom's UI is Updated
Encrypt it on Your Own!
Mr. Will · 2021-08-14 · via Mr. Will

Recently, I’ve written a CLI for RSA encryption and decryption - RSA CLI.

RSA CLI is based on Node.js, works perfectly with all the desktop platforms.

If you have Node.js environment on your device, with the help of npm, you can install it by running a single line of command:

1
$ npm install -g rsa-cli

Yarn is also supported:

1
$ yarn global add rsa-cli

Without Node.js environment, it’s still easy to install. Just download the executable for your device in GitHub Releases and execute it.


Now start encrypting:

0x00

1
$ rsa generate [keyName]

Run the command above to generate a new key pair. Modulus length is 2048 by default, and if you want to change it, use -l flag:

1
$ rsa generate [keyName] -l 4096

Remember [keyName], it’s needed for next steps.

0x01

Get your public key by running:

1
2
3
4
5
6
7
8
9
10
$ rsa get [keyName]
Public key of key pair '[keyName]':
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAv1n2RwSVDyfd7wsWo5g9Q3bG2uTU4eLxFFgX4coUSRYQKjVXH2zp
8QUmaRghF3qTumlWzCY6WJUvYQl6alu1/VrLOUCeQCat74nLxlIWI44GCB7vhGrC
ktqTpaVmFxa4aOAXT7WLGA15wcaW7hS4mdgbwehx4Bqisk+SjZqJ017ASBFMz02m
RNpKjQoJgRQWdDsr/VDNEKbAYl2ghVlTT9yidiCBJlLISkhTvLVmMzd2ULPzoa9F
8rXxpWJ/4j+rKJKpOaGJIKYCLTgZOXHLHZE7vPxBNK8L/nAV4XDI0S+QSwqVFR0A
uhXiHquN1Ae7wiyljqbei3vZylIYAaIkywIDAQAB
-----END RSA PUBLIC KEY-----

Copy -----BEGIN RSA ...... END RSA PUBLIC KEY----- and save it to a file, then send this file to your friend.

Your friend should also install RSA CLI, he/she need to download it and import it:

1
$ rsa import [yourFriendsKeyName] --public [path-to-the-file]

The next step is to encrypt a message:

1
$ rsa encrypt [yourFriendsKeyName] '[message]'

Finally, tell your friend to copy the output and send it to you.

0x02

After receiving the encrypted message from your friend, you can now decrypt it:

1
$ rsa decrypt [keyName] '[the-encrypted-message-from-your-friend]'

Done! you got the decrypted message from the output.


I think privacy should be in your control. You should not trust anyone who can’t proof your privacy is encrypted and private. Trust yourself. RSA CLI is an easy way to encrypt and decrypt on your own, which means you can really know your privacy is encrypted. Without private key, no one can decrypt your messages.

But why trusting RSA CLI? Because it’s fully open source.