Skip to content

Commit

Permalink
feat: Add proxy reencryption example code
Browse files Browse the repository at this point in the history
  • Loading branch information
rafagomes committed Aug 10, 2024
1 parent 464a763 commit 0fcbad6
Showing 1 changed file with 11 additions and 33 deletions.
44 changes: 11 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,20 @@ import (
)
```

### Example code
### Code Examples

```go
package main
#### Basic Encryption and Decryption

import (
"fmt"
"github.com/rafagomes/ecies-bls12381"
)
You can find the example code for basic encryption and decryption in the [examples/basic-encryption](examples/basic-encryption/main.go).

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))
}
```
This can also be found in the [example](example) directory.
<!-- TODO: CREATE THE PROXY REENCRYPTION EXAMPLE -->
#### Proxy Re-Encryption
You can find the example code for proxy re-encryption in the [examples/proxy-reencryption](examples/proxy-reencryption/main.go).

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

## Authors
@rafagomes

## License

Expand Down

0 comments on commit 0fcbad6

Please sign in to comment.