rscrypt

package module
v0.0.0-...-1a80a26 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 17 Imported by: 0

README

rscrypt

Universal tool for key generation, encryption and decryption, and signature verification. Supports AES, RSA, ECDSA

install

go install github.com/refitor/rscrypt@latest

test

go test -v

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)

func AesEncryptECB

func AesEncryptECB(origData []byte, key []byte) (encrypted []byte)

func EcdsaDecrypt

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

func EcdsaEncrypt

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

func EcdsaSign

func EcdsaSign(origData, privateKey []byte) (signature_encode string, err error)

func EcdsaVerify

func EcdsaVerify(origData, signature string, publicKey []byte) error

func GenerateAesKey

func GenerateAesKey(data string) string

=================== ECB ======================

func GenerateBitKey

func GenerateBitKey() ([]byte, []byte, error)

=================== ECDH ==================================== Generate elliptic curve key pair using secp256k1

func GenerateEcdsaKey

func GenerateEcdsaKey() ([]byte, []byte, error)

Generate elliptic curve key pair using secp256r1

func GenerateRsaKey

func GenerateRsaKey() ([]byte, []byte, error)

=================== RSA ==================================== https://www.sohamkamani.com/golang/rsa-encryption/

func GetRandom

func GetRandom(n int, isNO bool) string

func GetRandomInt

func GetRandomInt(max *big.Int) (int, error)

=================== random ===================

func GetSharedKey

func GetSharedKey(private, public []byte) ([]byte, error)

https://asecuritysite.com/encryption/goecdh

func Md5

func Md5(data string) string

func RsaDecrypt

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

func RsaEncrypt

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

func RsaSign

func RsaSign(origData, privateKey []byte) (string, error)

func RsaVerify

func RsaVerify(origData, signature, publicKey []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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