crypto

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToPKCS8

func EncodeToPKCS8(pkBlock *pem.Block) (*pem.Block, error)

func ReturnSignerInterface

func ReturnSignerInterface(pkBlock *pem.Block) (crypto.Signer, error)

Types

type CSRGenerator

type CSRGenerator interface {
	Generate() (crypto.PrivateKey, error)
	KeyType() string
	MarshalPrivateKey(key crypto.PrivateKey) ([]byte, error)
	SupportsPublicKeyAlgorithm(algorithm x509.PublicKeyAlgorithm) bool
	SupportsSigningAlgorithm(algorithm x509.SignatureAlgorithm) bool
	SupportsKeySize(size int) bool
}

type ECDSASigner

type ECDSASigner struct {
	PrivateKey         *ecdsa.PrivateKey
	SignatureAlgorithm x509.SignatureAlgorithm
	Hash               func() (hash.Hash, crypto.Hash)
}

func (*ECDSASigner) Sign

func (e *ECDSASigner) Sign(hashedData []byte) ([]byte, error)

type RSASigner

type RSASigner struct {
	PrivateKey         *rsa.PrivateKey
	SignatureAlgorithm x509.SignatureAlgorithm
	Hash               func() (hash.Hash, crypto.Hash)
}

func (*RSASigner) Sign

func (r *RSASigner) Sign(hashedData []byte) ([]byte, error)

type SigningRequestGeneratorECDSA

type SigningRequestGeneratorECDSA struct {
	Curve int
}

func (*SigningRequestGeneratorECDSA) Generate

ECDSA Interface

func (*SigningRequestGeneratorECDSA) KeyType

func (e *SigningRequestGeneratorECDSA) KeyType() string

func (*SigningRequestGeneratorECDSA) MarshalPrivateKey

func (e *SigningRequestGeneratorECDSA) MarshalPrivateKey(key crypto.PrivateKey) ([]byte, error)

func (*SigningRequestGeneratorECDSA) SupportsKeySize

func (e *SigningRequestGeneratorECDSA) SupportsKeySize(size int) bool

func (*SigningRequestGeneratorECDSA) SupportsPublicKeyAlgorithm

func (e *SigningRequestGeneratorECDSA) SupportsPublicKeyAlgorithm(algorithm x509.PublicKeyAlgorithm) bool

func (*SigningRequestGeneratorECDSA) SupportsSigningAlgorithm

func (e *SigningRequestGeneratorECDSA) SupportsSigningAlgorithm(algorithm x509.SignatureAlgorithm) bool

type SigningRequestGeneratorRSA

type SigningRequestGeneratorRSA struct {
	Size int
}

func (*SigningRequestGeneratorRSA) Generate

RSA Interface

func (*SigningRequestGeneratorRSA) KeyType

func (r *SigningRequestGeneratorRSA) KeyType() string

func (*SigningRequestGeneratorRSA) MarshalPrivateKey

func (r *SigningRequestGeneratorRSA) MarshalPrivateKey(key crypto.PrivateKey) ([]byte, error)

func (*SigningRequestGeneratorRSA) SupportsKeySize

func (r *SigningRequestGeneratorRSA) SupportsKeySize(size int) bool

func (*SigningRequestGeneratorRSA) SupportsPublicKeyAlgorithm

func (r *SigningRequestGeneratorRSA) SupportsPublicKeyAlgorithm(algorithm x509.PublicKeyAlgorithm) bool

func (*SigningRequestGeneratorRSA) SupportsSigningAlgorithm

func (r *SigningRequestGeneratorRSA) SupportsSigningAlgorithm(algorithm x509.SignatureAlgorithm) bool

Jump to

Keyboard shortcuts

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