Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownAlgorithm = fmt.Errorf("sshkey: unknown private key algorithm") ErrInvalidRSAKeySize = fmt.Errorf("sshkey: invalid private key rsa size: must be more than 1024") ErrInvalidECDSAKeySize = fmt.Errorf("sshkey: invalid private key ecdsa size, must be one of 256, 384 or 521") ErrInvalidDSAKeySize = fmt.Errorf("sshkey: invalid private key dsa size, must be one of 1024, 2048 or 3072") )
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm int
func AlgorithmString ¶
AlgorithmString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func AlgorithmValues ¶
func AlgorithmValues() []Algorithm
AlgorithmValues returns all values of the enum
func (Algorithm) IsAAlgorithm ¶
IsAAlgorithm returns "true" if the value is listed in the enum definition. "false" otherwise
type Pair ¶
Pair represents an ssh key pair, as in
func GeneratePair ¶
GeneratePair generates a Private/Public key pair using algorithm t.
When rand is nil "crypto/rand".Reader will be used.
bits specifies the number of bits in the key to create. For RSA keys, the minimum size is 1024 bits and the default is 3072 bits. Generally, 3072 bits is considered sufficient. DSA keys must be exactly 1024 bits - or 2 or 3 times that - as specified by FIPS 186-2. For ECDSA keys, bits determines the key length by selecting from one of three elliptic curve sizes: 256, 384 or 521 bits. Attempting to use bit lengths other than these three values for ECDSA keys will fail. Ed25519 keys have a fixed length and the bits will be ignored.
func PairFromDSA ¶
func PairFromDSA(key *dsa.PrivateKey) (*Pair, error)
PairFromDSA marshalls a valid pair of openssh pem for dsa keypairs. x509.MarshalPKCS8PrivateKey does not know how to deal with dsa keys.
func PairFromED25519 ¶
PairFromED25519 marshalls a valid pair of openssh pem for ED25519 keypairs. NewPair can handle ed25519 pairs but generates the wrong format apparently: `Load key "id_ed25519": invalid format` is the error that happens when I try to ssh with such a key.