Documentation ¶
Index ¶
- func ECDSAPrivateKeyToPEM(w io.Writer, key *ecdsa.PrivateKey, public bool) error
- func ECDSAPublicKeyToPEM(w io.Writer, key *ecdsa.PublicKey) error
- func PEMKeysFromFS(fsys fs.FS, dir string, glob string, parser PEMToKeyFactory, ...) (keys []interface{}, err error)
- func PEMToECDSAPrivateKey(data []byte) (key *ecdsa.PrivateKey, err error)
- func PEMToECDSAPublicKey(data []byte) (key *ecdsa.PublicKey, err error)
- func PEMToKey(fqPath string, pemData []byte, parser PEMToKeyFactory, keyTypes ...string) (keys []interface{}, err error)
- func PEMToRSAPrivateKey(data []byte) (key *rsa.PrivateKey, err error)
- func PEMToRSAPublicKey(data []byte) (key *rsa.PublicKey, err error)
- func RSAPrivateKeyToPEM(w io.Writer, key *rsa.PrivateKey, public bool) error
- func RSAPublicKeyToPEM(w io.Writer, key *rsa.PublicKey) error
- type PEMToKeyFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ECDSAPrivateKeyToPEM ¶
WriteECDSAKeys writes the private key onto _w_ using the PEM format.
If _public_ is set to `true`, it will include public as well.
func ECDSAPublicKeyToPEM ¶
WriteECDSAPublicKey writes the public key onto the _w_ `io.Writer`.
func PEMKeysFromFS ¶
func PEMKeysFromFS(fsys fs.FS, dir string, glob string, parser PEMToKeyFactory, keyTypes ...string, ) (keys []interface{}, err error)
PEMKeysFromFS loads a set of keys stored in _PEM_ files on the _fsys_.
The _glob_ is a `glob.Glob` expression to capture one or more files (recursively), for example _"**.pem"_ will capture all files ending with _.pem_ recursively down folders. If empty string the default is _"**.pem"_
The dir string is in which subdirectory to start, if empty string, it will start at root level.
All other parameters are the same as the `PEMToKey` function.
func PEMToECDSAPrivateKey ¶
func PEMToECDSAPrivateKey(data []byte) (key *ecdsa.PrivateKey, err error)
func PEMToKey ¶
func PEMToKey( fqPath string, pemData []byte, parser PEMToKeyFactory, keyTypes ...string, ) (keys []interface{}, err error)
PEMToKey decods the _data_ and uses the _parser_ function to parse out the actual key(s).
The parameter _fqPath_ is optional to denote where the _pemData_ was taken from.
func PEMToRSAPrivateKey ¶
func PEMToRSAPrivateKey(data []byte) (key *rsa.PrivateKey, err error)
func RSAPrivateKeyToPEM ¶
WriteRSAKeys writes the private key onto _w_ using the PEM format.
If _public_ is set to `true`, it will include public as well.
Types ¶
type PEMToKeyFactory ¶
PEMToKeyFactory creates keys from a pem input.
If the function sets `true` in _stop_ or returns an error. The _PEM_ stops immediately. If it returns an error, the `PEMToKey` function will return the same error along with no keys.
If the function do not return a key, it will be silently ignored, hence it is possible to do selective decoding of keys.
The _fqPath_ may be empty string if the factory was invoked on data without any path information.