publickey

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_TYPE_INVALID           = "INVALID"
	BLOCK_TYPE_PRIVATE_KEY_PKCS1 = "RSA PRIVATE KEY"
	BLOCK_TYPE_PRIVATE_KEY_PKCS8 = "PRIVATE KEY"
	BLOCK_TYPE_PUBLIC_KEY_PKCS1  = "RSA PUBLIC KEY"
	BLOCK_TYPE_PUBLIC_KEY_PKIX   = "PUBLIC KEY"
)
View Source
const (
	REPRESENTATION_INVALID = Representation(iota - 1)
	REPRESENTATION_RSA_PRIVATE_KEY_PKCS1
	REPRESENTATION_RSA_PRIVATE_KEY_PKCS8
	REPRESENTATION_RSA_PUBLIC_KEY_PKCS1
	REPRESENTATION_RSA_PUBLIC_KEY_PKIX
)

Variables

This section is empty.

Functions

func EncodePEM

func EncodePEM(key []byte, representation Representation) []byte

* Encode an RSA key in a certain representation as PEM.

func LoadRSAPrivateKey

func LoadRSAPrivateKey(keyData []byte, representation Representation) (*rsa.PrivateKey, error)

* Loads an RSA private key in ASN.1 encoding and either PKCS1 or PKCS8 * representation.

func LoadRSAPublicKey

func LoadRSAPublicKey(keyData []byte, representation Representation) (*rsa.PublicKey, error)

* Loads an RSA public key in ASN.1 encoding and either PKCS1 or PKIX * representation.

func SignPSS

func SignPSS(message []byte, key *rsa.PrivateKey, csprng io.Reader) ([]byte, error)

* Signs a message using RSA PSS.

func VerifyPSS

func VerifyPSS(message []byte, signature []byte, key *rsa.PublicKey) bool

* Verifies a signature using RSA PSS.

Types

type Representation

type Representation int8

func CreateRepresentation

func CreateRepresentation(blockType string) Representation

* Determines the representation of an RSA key from the PEM block type.

func DecodePEM

func DecodePEM(pemData []byte) ([]byte, Representation, error)

* Decode a PEM-encoded RSA key and return the decoded key material, the * representation and, potentially, an error.

func (*Representation) String

func (this *Representation) String() string

* Returns the PEM block type corresponding to this representation.

Jump to

Keyboard shortcuts

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