gq

package
v0.0.0-...-b2cb311 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GQ256 = jwa.SignatureAlgorithm("GQ256")

Functions

func OriginalJWTHeaders

func OriginalJWTHeaders(jwt []byte) ([]byte, error)

Types

type Signer

type Signer interface {
	// Sign creates a GQ1 signature over the given message with the given GQ1 private number.
	Sign(private []byte, message []byte) ([]byte, error)
	// SignJWT creates a GQ1 signature over the JWT token's header/payload with a GQ1 private number derived from the JWT signature.
	//
	// This works because a GQ1 private number can be calculated as the inverse mod n of an RSA signature, where n is the public RSA modulus.
	SignJWT(jwt []byte) ([]byte, error)
}

Signer allows for creating GQ1 signatures messages.

type SignerVerifier

type SignerVerifier interface {
	Signer
	Verifier
}

SignerVerifier combines the Signer and Verifier interfaces.

func NewSignerVerifier

func NewSignerVerifier(publicKey *rsa.PublicKey, securityParameter int) (SignerVerifier, error)

NewSignerVerifier creates a SignerVerifier from the RSA public key of the trusted third-party which creates the GQ1 private numbers.

The securityParameter parameter is the level of desired security in bits. 256 is recommended.

type Verifier

type Verifier interface {
	// Verify verifies a GQ1 signature over a message, using the public identity of the signer.
	Verify(signature []byte, identity []byte, message []byte) bool

	// Compatible with SignJWT, this function verifies the GQ1 signature of the presented JSON Web Token.
	VerifyJWT(jwt []byte) bool
}

Signer allows for verifying GQ1 signatures.

Jump to

Keyboard shortcuts

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