Skip to content

MrAndreID/gosignature

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MrAndreID / Go Signature

Go Reference License: MIT

The MrAndreID/GoSignature package is a collection of functions in the go language for Signature with rsa-sha256.


Table of Contents


Install

To use The MrAndreID/GoSignature package, you must follow the steps below:

go get -u github.com/MrAndreID/gosignature

Usage

Generate a Signature

signature, err := gosignature.Generate([]byte(`-----BEGIN RSA PRIVATE KEY-----
MIIBOQIBAAJAfBNTEHscBt+jNL+Ry1aqPoICoM8fuSpCkFN3KZ37zVEWu6Poav56
yp1i5D4ngVQ7vW2w2Go7M8TCfNS4aLna3wIDAQABAkAklCnj7Pd5S0s5TNT1poow
PXH66LVIiJ3xILo7ybincbp2jMc0Ah7TmuoTm9C0Uz8esoKWK2YGkLOykHSPxw25
AiEA2H3uURF/iqz4V5cJscbDMRQHc/qOpr22UF8utCkEMm0CIQCSt+ICBt2Y0Pir
BXjFmM6AcLHqwvy93gtypGx78dvS+wIgYCM0JH3/xGZhdgwVewPIBFBfquo2VOdk
Qbay98BLI9UCIHPzEJELffs0QyFdTKnUbnZBGcpvWLBwl9l9KiL17AUbAiEApiKl
aJkS7fmAd5XGd43BXgWJevG87yUzXxKPbsMp3mk=
-----END RSA PRIVATE KEY-----`), []byte(`Andrea Adam`))

Output:

ZMVHtYqKTgwsBItALtoE71ApBVJSQ1vxtW9a9oiugGZkhpIUBHtKTpL5e29CAeZnwlHTurUxpk1aH2RHx9sx3Q==

Signature Verification

verify, err := gosignature.Verify(signature, []byte(`-----BEGIN PUBLIC KEY-----
MFswDQYJKoZIhvcNAQEBBQADSgAwRwJAfBNTEHscBt+jNL+Ry1aqPoICoM8fuSpC
kFN3KZ37zVEWu6Poav56yp1i5D4ngVQ7vW2w2Go7M8TCfNS4aLna3wIDAQAB
-----END PUBLIC KEY-----`), []byte(`Andrea Adam`))

if verify == false {
    fmt.Println("Signature verification failed because : ", err)
} else {
    fmt.Println("Signature verification was successful")
}

Output:

Signature verification was successful

Full Example

Full Example can be found on the Go Playground website.

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Andrea Adam - MrAndreID

License

MIT licensed. See the LICENSE file for details.

Official Documentation for Go Language

Documentation for Go Language can be found on the Go Language website.

More

Documentation can be found on https://go.dev/.

About

A collection of functions in go language for signature with rsa-sha256.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages