iotmakerUtilTlsCertificates

package module
v0.0.0-...-b6f8102 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

README

iotmaker.util.tls.certificates

based on https://github.com/square/certigo and Peter Mattis works

Documentation

Overview

Package jceks parses JCEKS (Java Cryptogaphy Extension Key Store) files and extracts keys and certificates. This module only implements a fraction of the JCEKS cryptographic protocols. In particular, it implements the SHA1 signature verification of the key store and the PBEWithMD5AndDES3CBC cipher for encrypting private keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JavaKeyStoreGetCertificateByAlias

func JavaKeyStoreGetCertificateByAlias(keyStore KeyStore, alias string) (certificate *x509.Certificate, err error)

Get a x509certificate from java key store

func JavaKeyStoreGetCertificates

func JavaKeyStoreGetCertificates(keyStore KeyStore, alias, password string) (privateKey crypto.PrivateKey, certificates []*x509.Certificate, err error)

Get a x509certificate and private key from java key store

func JavaKeyStoreListCertificates

func JavaKeyStoreListCertificates(keyStore KeyStore) (list []string)

Get a list of certificates from java key store

func LoadFile

func LoadFile(filePath string) (file []byte, err error)

Load a file by name or file path

func NewTlsFromCertificates

func NewTlsFromCertificates(certificatesList [][]byte) (config *tls.Config, err error)

func NewTlsFromJavaKeyStore

func NewTlsFromJavaKeyStore(jksPath, alias, password string) (config *tls.Config, err error)

func NewTlsFromX509KeyPairFile

func NewTlsFromX509KeyPairFile(certFilePath, keyFilePath string) (config *tls.Config, err error)

func NewTlsFromX509KeyPar

func NewTlsFromX509KeyPar(certFile, keyFile []byte) (config *tls.Config, err error)

Types

type KeyStore

type KeyStore struct {
	// contains filtered or unexported fields
}

KeyStore maintains a map from alias name to the entry for that alias. Entries are currently either privateKeyEntry or trustedCertEntry.

func JavaKeyStoreLoadFile

func JavaKeyStoreLoadFile(filePath string, password string) (keyStore KeyStore, err error)

Parser a java key store file

func LoadFromFile

func LoadFromFile(filename string, password []byte) (*KeyStore, error)

LoadFromFile loads the key store from the specified file.

func LoadFromReader

func LoadFromReader(reader io.Reader, password []byte) (*KeyStore, error)

LoadFromReader loads the key store from the specified file.

func (*KeyStore) GetCert

func (ks *KeyStore) GetCert(alias string) (*x509.Certificate, error)

GetCert retrieves the specified certificate. Returns nil if the certificate does not exist or alias points to a non certificate entry.

func (*KeyStore) GetPrivateKeyAndCerts

func (ks *KeyStore) GetPrivateKeyAndCerts(alias string, password []byte) (
	key crypto.PrivateKey, certs []*x509.Certificate, err error)

GetPrivateKeyAndCerts retrieves the specified private key. Returns nil if the private key does not exist or alias points to a non private key entry.

func (*KeyStore) ListCerts

func (ks *KeyStore) ListCerts() []string

ListCerts lists the names of the certs stored in the key store.

func (*KeyStore) ListPrivateKeys

func (ks *KeyStore) ListPrivateKeys() []string

ListPrivateKeys lists the names of the private keys stored in the key store.

func (*KeyStore) Parse

func (ks *KeyStore) Parse(r io.Reader, password []byte) error

Parse parses the key store from the specified reader.

func (*KeyStore) String

func (ks *KeyStore) String() string

Jump to

Keyboard shortcuts

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