sign

package
v0.11.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCertificate

func DecodeCertificate(bytes []byte) (*x509.Certificate, error)

DecodeCertificate takes a byte slice, decodes it from the PEM format, converts it to an x509.Certificate object, and returns it. In case an error occurs, it returns the error.

func DecodePrivateKey

func DecodePrivateKey(bytes []byte) (*rsa.PrivateKey, error)

DecodePrivateKey takes a byte slice, decodes it from the PEM format, converts it to an rsa.PrivateKey object, and returns it. In case an error occurs, it returns the error.

func DecodePublicKey

func DecodePublicKey(pemBytes []byte) (*rsa.PublicKey, error)

DecodePublicKey takes a byte slice, decodes it from the PEM format, converts it to an rsa.PublicKey

func ExtractPubKey

func ExtractPubKey(cert *x509.Certificate) (*rsa.PublicKey, error)

ExtractPubKey extracts the RSA PublicKey of the given x509.Certificate.

func SHA256

func SHA256(in []byte) []byte

SHA256 generates the SHA256 checksum for the given bytes

func Sign

func Sign(privateKey *rsa.PrivateKey, data []byte) (string, error)

Sign signs data with an RSA Private Key and returns the base64 encoded signature

func VerifySignature

func VerifySignature(pubKey *rsa.PublicKey, sig string, data []byte) (bool, error)

VerifySignature verifies the given signature with the RSA public key and the given data

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL