rsa

package
v0.0.0-...-2083224 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

rsa

openssl

private key

openssl genrsa -out private.pem 1024

private 2 pkcs8

openssl pkcs8 -topk8 -inform PEM -in private.pem -outform pem -nocrypt -out pkcs8_private.pem

public key

openssl rsa -in private.pem -pubout -out public.pem

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertVerify

func CertVerify(hash crypto.Hash, hashed, cert, signature []byte) error

CertVerify rsa verify hashed := md5.Sum(src) hashed := sha256.Sum256(src) signature is a valid signature of message from the public key.

func Decrypt

func Decrypt(ciphertext, privateKey []byte) ([]byte, error)

Decrypt 私钥解密

func Encrypt

func Encrypt(origData, publicKey []byte) ([]byte, error)

Encrypt 公钥加密

func GenKey

func GenKey(bits int) error

GenKey 生成RSA公私钥文件

func MarshalPKCS8PrivateKey

func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte

MarshalPKCS8PrivateKey MarshalPKCS8PrivateKey

func Sign

func Sign(hash basecrypto.Hash, hashed, privateKey []byte) ([]byte, error)

Sign rsa sign hashed := md5.Sum(src) hashed := sha256.Sum256(src)

func Verify

func Verify(hash basecrypto.Hash, hashed, publicKey, signature []byte) error

Verify rsa verify hashed := md5.Sum(src) hashed := sha256.Sum256(src) signature is a valid signature of message from the public key.

Types

This section is empty.

Directories

Path Synopsis
sample
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL