arxiver / rsam

Modified package for RSA encryption/decryption to allow large message encryption/decryption, to allow encryption through private key and decryption through public key and signature through public key and private key and vice versa. i.e. Additional functionalities to the existing crypto package https://pkg.go.dev/github.com/gossl/rsam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rsa-modified (rsam)

Supports additional functionalites and important stuff must be done in some corner cases and some specific applications

Modified package for RSA encryption and decryption to allow large message encryption and decryption and to allow encryption through private key and decryption through public key and signature through public key and private key and vice versa. i.e. Additional functionalities to the existing crypto package

Installation

go get "github.com/gossl/rsam"

Usage

import  (
  "bytes"
  "fmt"
  
  "github.com/gossl/rsam"
)

func main(){
  priv, pub, err := rsam.GenerateKeyPair(2048)
  if err != nil {
    panic(err)
  }
  msg := []byte("hello world")
  ciphertext, err := rsam.EncryptWithPrivateKey(msg, priv, sha256.New())
  if err != nil {
    panic(err)
  }
  plaintext, err := rsam.DecryptWithPublicKey(encrypted, pub, sha256.New())
  if err != nil {
    panic(err)
  }
  if !bytes.Equal(msg, plaintext) {
   panic(nil)
 }
}

About

Modified package for RSA encryption/decryption to allow large message encryption/decryption, to allow encryption through private key and decryption through public key and signature through public key and private key and vice versa. i.e. Additional functionalities to the existing crypto package https://pkg.go.dev/github.com/gossl/rsam

License:MIT License


Languages

Language:Go 100.0%