rsa

package
v0.0.0-...-05098b9 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RSA2048 common rsa byte size 2048
	RSA2048 = 2048

	// RSA4096 common rsa byte size 4096
	RSA4096 = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IRSA

type IRSA interface {
	R2048() (*rsa.PrivateKey, *rsa.PublicKey, error)
	R4096() (*rsa.PrivateKey, *rsa.PublicKey, error)

	R2048PrivateKey() (*rsa.PrivateKey, error)
	R4096PrivateKey() (*rsa.PrivateKey, error)

	R2048PEM() (*rsa.PrivateKey, p.PrivatePEM, *rsa.PublicKey, p.PublicPEM, error)
	R4096PEM() (*rsa.PrivateKey, p.PrivatePEM, *rsa.PublicKey, p.PublicPEM, error)

	R2048PEMPrivateKey() (*rsa.PrivateKey, p.PrivatePEM, error)
	R4096PEMPrivateKey() (*rsa.PrivateKey, p.PrivatePEM, error)

	FromPEMPrivateKey(p.PrivatePEM) (*rsa.PrivateKey, error)
	FromPEMPublicKey(p.PublicPEM) (*rsa.PublicKey, error)
	FromPEM(p.PrivatePEM, p.PublicPEM) (*rsa.PrivateKey, *rsa.PublicKey, error)

	ToPEMPrivateKey(*rsa.PrivateKey) (p.PrivatePEM, error)
	ToPEMPublicKey(*rsa.PublicKey) (p.PublicPEM, error)
	ToPEM(*rsa.PrivateKey, *rsa.PublicKey) (p.PrivatePEM, p.PublicPEM, error)

	ToJWKRS256(publicKey *rsa.PublicKey, id string) ([]byte, error)
	ToJWKRS512(publicKey *rsa.PublicKey, id string) ([]byte, error)
	ToJWK(publicKey *rsa.PublicKey, id string, algo jose.SignatureAlgorithm) ([]byte, error)
}

IRSA interface for methods to generate rsa keys and conversion to PEM format

func NewRSA

func NewRSA() IRSA

NewRSA gets a new RSA pointer

type RSA

type RSA struct{}

RSA struct to implement the IRSA methods

func (*RSA) FromPEM

func (r *RSA) FromPEM(privatePEM p.PrivatePEM, publicPEM p.PublicPEM) (*rsa.PrivateKey, *rsa.PublicKey, error)

FromPEM takes pem keys and converts them into a rsa keys

func (*RSA) FromPEMPrivateKey

func (r *RSA) FromPEMPrivateKey(privatePEM p.PrivatePEM) (*rsa.PrivateKey, error)

FromPEMPrivateKey takes a private pem key and converts it into a rsa private key

func (*RSA) FromPEMPublicKey

func (r *RSA) FromPEMPublicKey(publicPEM p.PublicPEM) (*rsa.PublicKey, error)

FromPEMPublicKey takes a public pem key and converts it into a rsa public key

func (*RSA) R2048

func (r *RSA) R2048() (*rsa.PrivateKey, *rsa.PublicKey, error)

R2048 generates a new RSA-2048 private/public keys

func (*RSA) R2048PEM

func (r *RSA) R2048PEM() (*rsa.PrivateKey, p.PrivatePEM, *rsa.PublicKey, p.PublicPEM, error)

R2048PEM generates new RSA-2048 private/public pem keys

func (*RSA) R2048PEMPrivateKey

func (r *RSA) R2048PEMPrivateKey() (*rsa.PrivateKey, p.PrivatePEM, error)

R2048PEMPrivateKey generates a new RSA-2048 private PEM key

func (*RSA) R2048PrivateKey

func (r *RSA) R2048PrivateKey() (*rsa.PrivateKey, error)

R2048PrivateKey generates a new RSA-2048 private key

func (*RSA) R4096

func (r *RSA) R4096() (*rsa.PrivateKey, *rsa.PublicKey, error)

R4096 generates a new RSA-4096 private/public keys

func (*RSA) R4096PEM

func (r *RSA) R4096PEM() (*rsa.PrivateKey, p.PrivatePEM, *rsa.PublicKey, p.PublicPEM, error)

R4096PEM generates new RSA-4096 private/public pem keys

func (*RSA) R4096PEMPrivateKey

func (r *RSA) R4096PEMPrivateKey() (*rsa.PrivateKey, p.PrivatePEM, error)

R4096PEMPrivateKey generates a new RSA-4096 private PEM key

func (*RSA) R4096PrivateKey

func (r *RSA) R4096PrivateKey() (*rsa.PrivateKey, error)

R4096PrivateKey generates a new RSA-4096 private key

func (*RSA) ToJWK

func (r *RSA) ToJWK(publicKey *rsa.PublicKey, id string, algo jose.SignatureAlgorithm) ([]byte, error)

ToJWK converts RSA public key into a jwk

func (*RSA) ToJWKRS256

func (r *RSA) ToJWKRS256(publicKey *rsa.PublicKey, id string) ([]byte, error)

ToJWKRS256 converts RSA 2048 public key into a jwk RS256

func (*RSA) ToJWKRS512

func (r *RSA) ToJWKRS512(publicKey *rsa.PublicKey, id string) ([]byte, error)

ToJWKRS512 converts RSA 4096 public key into a jwk RS512

func (*RSA) ToPEM

func (r *RSA) ToPEM(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey) (p.PrivatePEM, p.PublicPEM, error)

ToPEM converts rsa private & public keys, into private & public PEM keys

func (*RSA) ToPEMPrivateKey

func (r *RSA) ToPEMPrivateKey(privateKey *rsa.PrivateKey) (p.PrivatePEM, error)

ToPEMPrivateKey converts a RSA private key into a private PEM key

func (*RSA) ToPEMPublicKey

func (r *RSA) ToPEMPublicKey(publicKey *rsa.PublicKey) (p.PublicPEM, error)

ToPEMPublicKey converts a RSA public key into a public PEM key

Jump to

Keyboard shortcuts

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