jks

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPassword   = errors.New("password is not set for store")
	ErrInvalidAlias = errors.New("alias must not be an empty string")
)

Functions

This section is empty.

Types

type KeystoreBuilder

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

KeystoreBuilder provides a builder interface to generate JKS keystores.

func NewKeystoreBuilder

func NewKeystoreBuilder() *KeystoreBuilder

NewKeystoreBuilder creates a new KeyStoreBuilder.

func (*KeystoreBuilder) AddCert

func (k *KeystoreBuilder) AddCert(alias string, cert []byte, key []byte, caCerts ...[]byte)

AddCert adds a certificate and private key to the key store. If an alias is reused, this overwrites the previous cert.

Parameters:

`alias`   - Alias for cert/key pair
`cert`    - Certificate, in X.509 PEM format
`key`     - Private key, in PEM format
`caCerts` - Optional intermediate certificate authorities to add to keypair, in X.509 PEM format

func (*KeystoreBuilder) Build

func (k *KeystoreBuilder) Build() ([]byte, error)

Build constructs the keystore from the builder contents.

func (*KeystoreBuilder) SetPassword

func (k *KeystoreBuilder) SetPassword(password string)

SetPassword sets the keystore password.

Jump to

Keyboard shortcuts

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