rsa

package
v0.0.0-...-df740be Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package encrypt rsa encryption and decryption Author: Frank Lee Date: 2017-11-17 11:51:41 Last Modified by: Frank Lee Last Modified time: 2018-03-22 13:35:41

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cipherText string, privateKey *rsa.PrivateKey) ([]byte, error)

Decrypt rsa decrypt param cipherText: cipher text param privateKey: private key return []byte: plain bytes return error: errors

func Encrypt

func Encrypt(plainText string, publicKey *rsa.PublicKey) ([]byte, error)

Encrypt rsa encrypt param plainText: plain text param publicKey: public key string return []byte: cipher bytes return error: errors

func GeneratePrivateKey

func GeneratePrivateKey(privateKey []byte, keyType KeyType) (*rsa.PrivateKey, error)

GeneratePrivateKey generate private key using key string

func GeneratePrivateKeyFromFile

func GeneratePrivateKeyFromFile(keyPath string, keyType KeyType) (*rsa.PrivateKey, error)

GeneratePrivateKeyFromFile generate private key using pem file

func GeneratePublicKey

func GeneratePublicKey(publicKey []byte) (*rsa.PublicKey, error)

GeneratePublicKey generate public key using key string

func GeneratePublicKeyFromFile

func GeneratePublicKeyFromFile(keyPath string) (*rsa.PublicKey, error)

GeneratePublicKeyFromFile generate public key using pem file

Types

type KeyType

type KeyType int64

KeyType key type

const (

	// PKCS1 pkcs1
	PKCS1 KeyType = iota

	// PKCS8 pkcs8
	PKCS8
)

Jump to

Keyboard shortcuts

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