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") ErrDSANotSupported = fmt.Errorf("sshkey: DSA keys are no longer supported, use ecdsa, ed25519 or rsa instead") // Deprecated: DSA is no longer supported and this error is no longer // returned. See ErrDSANotSupported. ErrInvalidDSAKeySize = fmt.Errorf("sshkey: invalid private key dsa size, must be one of 1024, 2048 or 3072") )
Functions ¶
func AlgorithmStrings ¶ added in v0.5.4
func AlgorithmStrings() []string
AlgorithmStrings returns a slice of all String values of the enum
func PublicKeyFromPrivate ¶ added in v0.3.2
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 4096 bits. Generally, 3072 bits is considered sufficient. 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.
DSA is no longer supported and returns ErrDSANotSupported.
func PairFromDSA
deprecated
func PairFromDSA(_ *dsa.PrivateKey) (*Pair, error)
PairFromDSA always returns ErrDSANotSupported.
Deprecated: DSA is no longer supported by golang.org/x/crypto/ssh. Use ECDSA, ED25519 or RSA keys instead.
func PairFromED25519 ¶
PairFromED25519 marshals a valid pair of openssh pem for ED25519 keypairs.