Category: Study

openssl 签名和验证签名 举例

最近有不少人问我如何用openssl命令行来进行签名,验证签名,以及其它一些openssl的命令。 其实我对openssl也不太了解,倒是对rsa了解得比较多一些,像rsa背后的欧拉公式以及证明啊什么的,呵呵呵。 写一个小脚本,里面包含了加密/解密,签名/验证签名等一些例子,仅供参考。 [shell] #!/bin/bash set -e set -x # Generate 1024 bits rsa private key and output to file "test.key". # This private key was encrypted by AES256 with the password "hukeping". openssl genrsa -aes256 -passout pass:hukeping  -out test.key 1024 # Generate public key from the private key file "test.key" and output it to […]

Fail when go get gopkg.in/yaml.v2

One may comes across some error on install yaml.v2 using `go get`, like: $ go get gopkg.in/yaml.v2 package gopkg.in/yaml.v2: unrecognized import path “gopkg.in/yaml.v2” Usually it’s a network error, please try: $ go get -v gopkg.in/yaml.v2 Fetching https://gopkg.in/yaml.v2?go-get=1 https fetch failed. import “gopkg.in/yaml.v2”: https fetch: Get https://gopkg.in/yaml.v2?go-get=1: x509: certificate signed by unknown authority package gopkg.in/yaml.v2: unrecognized […]