Skip to content

ecies-bls12381 is a Go package that simplifies keypair generation, encryption, and decryption using ECIES with the BLS12381 elliptic curve. It leverages the Kyber cryptographic library for secure operations, making it easy for developers to integrate robust cryptographic functionalities into their applications. Suitable for proxy re-encryption.

License

Notifications You must be signed in to change notification settings

rafagomes/ecies-bls12381

Repository files navigation

Package ecies-bls12381

GoDoc codecov Go Report Card License: MIT

ecies-bls12381 is a Go package that simplifies keypair generation, encryption, and decryption using Elliptic Curve Integrated Encryption Scheme (ECIES) with the BLS12381 elliptic curve. It leverages the Kyber cryptographic library for secure operations, making it easy for developers to integrate robust cryptographic functionalities into their applications. Suitable for proxy re-encryption.

This package is built on top of the github.com/drand/kyber library, which provides a high-level API for cryptographic operations. The BLS12381 elliptic curve is a pairing-friendly curve that is widely used in cryptographic applications, including proxy re-encryption and secure data sharing.

Key Features

  • Key Pair Generation: Generate secure elliptic curve key pairs.
  • Public Key Derivation: Derive public keys from private keys.
  • Message Encryption: Encrypt messages securely using public keys.
  • Message Decryption: Decrypt messages using corresponding private keys.
  • Proxy Re-Encryption Support: Suitable for use cases involving proxy re-encryption for secure data sharing.

Installation

To install the package, run:

go get github.com/rafagomes/ecies-bls12381

Usage

package main

import (
	"fmt"

	eciesbls12381 "github.com/rafagomes/ecies-bls12381"
)

func main() {
	// Generate key pair
	publicKey, privateKey := eciesbls12381.GenerateECKeypair()
	fmt.Println("Public Key:", publicKey)
	fmt.Println("Private Key:", privateKey)

	// Encrypt a message
	message := []byte("Hello, BLS12381!")
	ciphertext, err := eciesbls12381.EncryptWithEC(publicKey, message)
	if err != nil {
		fmt.Println("Encryption error:", err)
		return
	}
	fmt.Println("Ciphertext:", ciphertext)

	// Decrypt the message
	plaintext, err := eciesbls12381.DecryptWithEC(privateKey, ciphertext)
	if err != nil {
		fmt.Println("Decryption error:", err)
		return
	}
	fmt.Println("Plaintext:", string(plaintext))
}

Code Examples

Basic Encryption and Decryption

You can find the example code for basic encryption and decryption in the examples/basic-encryption.

Proxy Re-Encryption

You can find the example code for proxy re-encryption in the examples/proxy-reencryption.

Contributing

Feel free to open issues and pull requests. Any feedback is highly appreciated!

Authors

@rafagomes

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

ecies-bls12381 is a Go package that simplifies keypair generation, encryption, and decryption using ECIES with the BLS12381 elliptic curve. It leverages the Kyber cryptographic library for secure operations, making it easy for developers to integrate robust cryptographic functionalities into their applications. Suitable for proxy re-encryption.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages