pki

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 5 Imported by: 0

README

pki

Package pki provides various generally useful PKI functionality.

Documentation

Overview

Package pki provides various generally useful PKI functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFromFile

func CSRFromFile(filename string) (*x509.CertificateRequest, error)

CSRFromFile reads a PEM-encoded file and returns the PKCS#10 certificate signing request it contains. If the file does not contain a PEM-encoded PKCS#10 certificate signing request, an error is returned.

func CSRToPEMString

func CSRToPEMString(csr *x509.CertificateRequest) string

CSRToPEMString encodes a CSR to a PEM-encoded string.

func CertFromFile

func CertFromFile(filename string) (*x509.Certificate, error)

CertFromFile reads a PEM-encoded file and returns the X509 certificate it contains. If the file does not contain a PEM-encoded X509 certificate, an error is returned.

func CertToPEMString

func CertToPEMString(cert *x509.Certificate) string

CertToPEMString encodes a certificate to a PEM-encoded string.

func FileIsEncryptedPEMBlock

func FileIsEncryptedPEMBlock(filename string) bool

FileIsEncryptedPEMBlock checks if the specified file is an encrypted PEM block.

func PEMBlockFromFile

func PEMBlockFromFile(filename string) (*pem.Block, error)

PEMBlockFromFile reads a PEM-encoded file and returns a pem.Block.

func PrivateKeyFromFileWithPassword

func PrivateKeyFromFileWithPassword(filename, password string) (interface{}, error)

PrivateKeyFromFileWithPassword reads a PEM-encoded file and returns the private key it contains, decrypting it with the supplied password if necessary. If the file does not contain a PEM-encoded private key, an error is returned.

func PublicKeyFromFile

func PublicKeyFromFile(filename string) (interface{}, error)

PublicKeyFromFile reads a PEM-encoded file and returns the public key it private key it contains. If the file does not contain a PEM-encoded public key, an error is returned.

func PublicKeyToPEMString

func PublicKeyToPEMString(key interface{}) (string, error)

PublicKeyToPEMString encodes a PKIX public key to a PEM-encoded string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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