rsa

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Algorithm = "RSASSA-PKCS1-V1_5"

Algorithm defines the type for the RSA PKCS #1 v1.5 signature algorithm.

View Source
const MediaType = "application/vnd.ocm.signature.rsa"

MediaType defines the media type for a plain RSA signature.

View Source
const MediaTypePEM = "application/x-pem-file"

MediaTypePEM defines the media type for PEM formatted data.

View Source
const SignaturePEMBlockAlgorithmHeader = "Signature Algorithm"

SignaturePEMBlockAlgorithmHeader defines the header in a signature pem block where the signature algorithm is defined.

View Source
const SignaturePEMBlockType = "SIGNATURE"

SignaturePEMBlockType defines the type of a signature pem block.

Variables

This section is empty.

Functions

func GetPrivateKey

func GetPrivateKey(key interface{}) (*rsa.PrivateKey, error)

func GetPublicKey

func GetPublicKey(key interface{}) (*rsa.PublicKey, []string, error)

func GetSignaturePEMBlocks

func GetSignaturePEMBlocks(pemData []byte) ([]*pem.Block, error)

GetSignaturePEMBlocks returns all signature pem blocks from a list of pem blocks.

func KeyData

func KeyData(key interface{}) ([]byte, error)

func ParseKey

func ParseKey(data []byte) (interface{}, error)

func ParsePrivateKey

func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)

func ParsePublicKey

func ParsePublicKey(data []byte) (interface{}, error)

func PemBlockForKey

func PemBlockForKey(priv interface{}, gen ...bool) (*pem.Block, error)

func WriteKeyData

func WriteKeyData(key interface{}, w io.Writer) error

Types

type Handler

type Handler struct{}

Handler is a signatures.Signer compatible struct to sign with RSASSA-PKCS1-V1_5. and a signatures.Verifier compatible struct to verify RSASSA-PKCS1-V1_5 signatures.

func (Handler) Algorithm

func (h Handler) Algorithm() string

func (Handler) CreateKeyPair

func (_ Handler) CreateKeyPair() (priv interface{}, pub interface{}, err error)

func (Handler) Sign

func (h Handler) Sign(cctx credentials.Context, digest string, hash crypto.Hash, issuer string, key interface{}) (signature *signing.Signature, err error)

func (Handler) Verify

func (h Handler) Verify(digest string, hash crypto.Hash, signature *signing.Signature, key interface{}) (err error)

Verify checks the signature, returns an error on verification failure.

type PrivateKey

type PrivateKey = rsa.PrivateKey

type PublicKey

type PublicKey = rsa.PublicKey

Jump to

Keyboard shortcuts

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