kritis3mpki

package
v0.0.0-...-db381cb Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KRITIS3M_PKI_SUCCESS          = C.KRITIS3M_PKI_SUCCESS
	KRITIS3M_PKI_MEMORY_ERROR     = C.KRITIS3M_PKI_MEMORY_ERROR
	KRITIS3M_PKI_ARGUMENT_ERROR   = C.KRITIS3M_PKI_ARGUMENT_ERROR
	KRITIS3M_PKI_PEM_DECODE_ERROR = C.KRITIS3M_PKI_PEM_DECODE_ERROR
	KRITIS3M_PKI_PEM_ENCODE_ERROR = C.KRITIS3M_PKI_PEM_ENCODE_ERROR
	KRITIS3M_PKI_KEY_ERROR        = C.KRITIS3M_PKI_KEY_ERROR
	KRITIS3M_PKI_KEY_UNSUPPORTED  = C.KRITIS3M_PKI_KEY_UNSUPPORTED
	KRITIS3M_PKI_CSR_ERROR        = C.KRITIS3M_PKI_CSR_ERROR
	KRITIS3M_PKI_CSR_EXT_ERROR    = C.KRITIS3M_PKI_CSR_EXT_ERROR
	KRITIS3M_PKI_CSR_SIGN_ERROR   = C.KRITIS3M_PKI_CSR_SIGN_ERROR
	KRITIS3M_PKI_CERT_ERROR       = C.KRITIS3M_PKI_CERT_ERROR
	KRITIS3M_PKI_CERT_EXT_ERROR   = C.KRITIS3M_PKI_CERT_EXT_ERROR
	KRITIS3M_PKI_CERT_SIGN_ERROR  = C.KRITIS3M_PKI_CERT_SIGN_ERROR
	KRITIS3M_PKI_PKCS11_ERROR     = C.KRITIS3M_PKI_PKCS11_ERROR
)
View Source
const (
	KRITIS3M_PKI_LOG_LEVEL_ERR = C.KRITIS3M_PKI_LOG_LEVEL_ERR
	KRITIS3M_PKI_LOG_LEVEL_WRN = C.KRITIS3M_PKI_LOG_LEVEL_WRN
	KRITIS3M_PKI_LOG_LEVEL_INF = C.KRITIS3M_PKI_LOG_LEVEL_INF
	KRITIS3M_PKI_LOG_LEVEL_DBG = C.KRITIS3M_PKI_LOG_LEVEL_DBG
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm string
const (
	ALGORITHMRSA2048 Algorithm = "rsa2048"
	ALGORITHMRSA3072 Algorithm = "rsa3072"
	ALGORITHMRSA4096 Algorithm = "rsa4096"
	ALGORITHMSECP256 Algorithm = "secp256"
	ALGORITHMSECP384 Algorithm = "secp384"
	ALGORITHMSECP521 Algorithm = "secp521"
	ALGORITHMED25519 Algorithm = "ed25519"
	ALGORITHMED448   Algorithm = "ed448"
	ALGORITHMMLDSA44 Algorithm = "mldsa44"
	ALGORITHMMLDSA65 Algorithm = "mldsa65"
	ALGORITHMMLDSA87 Algorithm = "mldsa87"
)

type CustomLogCallback

type CustomLogCallback C.kritis3m_pki_log_callback

type KRITIS3MPKI

type KRITIS3MPKI struct {
	OutputCert    *C.OutputCert
	IssuerCert    *C.IssuerCert
	PrivateKey    *C.PrivateKey
	Error         *KRITIS3MPKIError
	Configuration *KRITIS3MPKIConfiguration
	CSR           *C.SigningRequest
}

KRITIS3MPKI represents the PKI configuration and operations

func InitPKI

func InitPKI(config *KRITIS3MPKIConfiguration) *KRITIS3MPKI

NewKRITIS3MPKI creates a new KRITIS3MPKI instance

func (*KRITIS3MPKI) Cleanup

func (s *KRITIS3MPKI) Cleanup()

Cleanup frees all allocated resources

func (*KRITIS3MPKI) CreateCSR

func (s *KRITIS3MPKI) CreateCSR(metadata SigningRequestMetadata) error

CreateCSR creates a new Certificate Signing Request

func (*KRITIS3MPKI) CreateCertificate

func (s *KRITIS3MPKI) CreateCertificate(csrData []byte, validity int, isCA bool) error

CreateCertificate creates a new certificate from a CSR

func (*KRITIS3MPKI) FinalizeCSR

func (s *KRITIS3MPKI) FinalizeCSR() (*x509.CertificateRequest, error)

FinalizeCSR finalizes the CSR and returns it as a byte slice

func (*KRITIS3MPKI) FinalizeCertificate

func (s *KRITIS3MPKI) FinalizeCertificate() ([]byte, error)

FinalizeCertificate finalizes the certificate and returns it as a byte slice

func (*KRITIS3MPKI) GeneratePrivateKey

func (s *KRITIS3MPKI) GeneratePrivateKey(algorithm Algorithm) error

GeneratePrivateKey generates a new private key

func (*KRITIS3MPKI) GeneratePrivateKeyAlt

func (s *KRITIS3MPKI) GeneratePrivateKeyAlt(algorithm Algorithm) error

GeneratePrivateKeyAlt generates a new alternative private key

func (*KRITIS3MPKI) LoadIssuerCert

func (s *KRITIS3MPKI) LoadIssuerCert(certData []byte) error

LoadIssuerCert loads an issuer certificate from a PEM-encoded buffer

func (*KRITIS3MPKI) LoadPrivateKey

func (s *KRITIS3MPKI) LoadPrivateKey(keyData []byte) error

LoadPrivateKey loads a private key from a PEM-encoded buffer

func (*KRITIS3MPKI) LoadPrivateKeyAlt

func (s *KRITIS3MPKI) LoadPrivateKeyAlt(keyData []byte) error

LoadPrivateKeyAlt loads an alternative private key from a PEM-encoded buffer

type KRITIS3MPKIConfiguration

type KRITIS3MPKIConfiguration struct {
	LogLevel          int
	LoggingEnabled    bool
	CustomLogCallback CustomLogCallback
}

KRITIS3MPKIConfiguration represents the PKI configuration

type KRITIS3MPKIError

type KRITIS3MPKIError struct {
	Code    int
	Message string
}

KRITIS3MPKIError represents a PKI error

func (*KRITIS3MPKIError) Error

func (e *KRITIS3MPKIError) Error() string

KRITIS3MPKIError returns the error message for the given error code

type SigningRequestMetadata

type SigningRequestMetadata struct {
	CSR *x509.CertificateRequest
}

SigningRequestMetadata => x509.CertificateRequest

Jump to

Keyboard shortcuts

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