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 ¶
- func JavaKeyStoreGetCertificateByAlias(keyStore KeyStore, alias string) (certificate *x509.Certificate, err error)
- func JavaKeyStoreGetCertificates(keyStore KeyStore, alias, password string) (privateKey crypto.PrivateKey, certificates []*x509.Certificate, err error)
- func JavaKeyStoreListCertificates(keyStore KeyStore) (list []string)
- func LoadFile(filePath string) (file []byte, err error)
- func NewTlsFromCertificates(certificatesList [][]byte) (config *tls.Config, err error)
- func NewTlsFromJavaKeyStore(jksPath, alias, password string) (config *tls.Config, err error)
- func NewTlsFromX509KeyPairFile(certFilePath, keyFilePath string) (config *tls.Config, err error)
- func NewTlsFromX509KeyPar(certFile, keyFile []byte) (config *tls.Config, err error)
- type KeyStore
- func (ks *KeyStore) GetCert(alias string) (*x509.Certificate, error)
- func (ks *KeyStore) GetPrivateKeyAndCerts(alias string, password []byte) (key crypto.PrivateKey, certs []*x509.Certificate, err error)
- func (ks *KeyStore) ListCerts() []string
- func (ks *KeyStore) ListPrivateKeys() []string
- func (ks *KeyStore) Parse(r io.Reader, password []byte) error
- func (ks *KeyStore) String() string
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 ¶
Get a list of certificates from java key store
func NewTlsFromCertificates ¶
func NewTlsFromJavaKeyStore ¶
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 ¶
Parser a java key store file
func LoadFromFile ¶
LoadFromFile loads the key store from the specified file.
func LoadFromReader ¶
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) ListPrivateKeys ¶
ListPrivateKeys lists the names of the private keys stored in the key store.