Documentation ¶
Index ¶
- func GenerateKey(passphrase []byte, n int) (pri, pub []byte, err error)
- func ParsePrivateKey(bs []byte) (*rsa.PrivateKey, error)
- func ParsePrivateKeyTTY(name string, bs []byte) (*rsa.PrivateKey, error)
- func ParsePublicKey(bs []byte) (*rsa.PublicKey, error)
- func PublicKeyHash(k *rsa.PublicKey) ([]byte, error)
- func PublicKeyHashString(k *rsa.PublicKey) (string, error)
- func ReadPrivateKey(f string) (*rsa.PrivateKey, error)
- func ReadPrivateKeyTTY(pemFile string) (*rsa.PrivateKey, error)
- func ReadPublicKey(f string) (*rsa.PublicKey, error)
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey generates a private/public key pair with the given passphrase. n is the bit size of the RSA key. When n is less than 0, 4096 is used.
func ParsePrivateKey ¶
func ParsePrivateKey(bs []byte) (*rsa.PrivateKey, error)
ParsePrivateKey parses the PEM encoded RSA private key.
func ParsePrivateKeyTTY ¶
func ParsePrivateKeyTTY(name string, bs []byte) ( *rsa.PrivateKey, error, )
ParsePrivateKeyTTY parses a private key and asks for the passphrase if the key is an encrypted PEM.
func ParsePublicKey ¶
ParsePublicKey parses a marshalled public key in SSH authorized key format.
func PublicKeyHash ¶
PublicKeyHash returns the public key hash of a key.
func PublicKeyHashString ¶
PublicKeyHashString returns the public key hash string of a key.
func ReadPrivateKey ¶
func ReadPrivateKey(f string) (*rsa.PrivateKey, error)
ReadPrivateKey parses the PEM encded RSA private key file.
func ReadPrivateKeyTTY ¶
func ReadPrivateKeyTTY(pemFile string) (*rsa.PrivateKey, error)
ReadPrivateKeyTTY reads a private key from a key file.
Types ¶
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey carries a public key.
func NewPublicKey ¶
NewPublicKey parses a new public key from SSH authorized key format.
func ParsePublicKeys ¶
ParsePublicKeys parses a list of public keys.