Skip to content
/ rsam Public

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

Notifications You must be signed in to change notification settings

arxiver/rsam

Repository files navigation

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages