https://github.com/itrabbit/ecc
Golang ECC encrypt / decrypt, compatible with swift library https://github.com/IBM-Swift/BlueECC, only prime256v1
https://github.com/itrabbit/ecc
blueecc ecc go golang ibm prime256v1
Last synced: 5 months ago
JSON representation
Golang ECC encrypt / decrypt, compatible with swift library https://github.com/IBM-Swift/BlueECC, only prime256v1
- Host: GitHub
- URL: https://github.com/itrabbit/ecc
- Owner: itrabbit
- License: mit
- Created: 2020-06-20T21:44:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-20T21:53:23.000Z (about 6 years ago)
- Last Synced: 2024-06-20T14:18:57.267Z (about 2 years ago)
- Topics: blueecc, ecc, go, golang, ibm, prime256v1
- Language: Go
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Compatible with swift library https://github.com/IBM-Swift/BlueECC
### Example usage
```go
package main
import (
"fmt"
"github.com/itrabbit/ecc"
)
func main() {
private, err := ecc.GenerateKey()
if err != nil {
panic(err.Error())
}
encrypted, err := ecc.Encrypt(&private.PublicKey, []byte("hello"))
if err != nil {
panic(err.Error())
}
fmt.Println("encrypted", encrypted, len(encrypted));
// -> encrypted [4 13 13 236 218 227 ... 89] 86
decrypted, err := ecc.Decrypt(private, encrypted)
if err != nil {
panic(err.Error())
}
fmt.Println("decrypted", decrypted, string(decrypted))
// -> decrypted [104 101 108 108 111] hello
}
```