func PublicKey(privateKey []byte, comment string) (string, error) {
	signer, err := ssh.ParsePrivateKey(privateKey)
	if err != nil {
		return "", errors.Annotate(err, "failed to load key")
	}

	auth_key := string(ssh.MarshalAuthorizedKey(signer.PublicKey()))
	// Strip off the trailing new line so we can add a comment.
	auth_key = strings.TrimSpace(auth_key)
	public := fmt.Sprintf("%s %s\n", auth_key, comment)

	return public, nil
}
// PublicKey returns the public key for any private key. The public key is
// suitable to be added into an authorized_keys file, and has the comment
// passed in as the comment part of the key.
PublicKey returns the public key for any private key. The public key is
suitable to be added into an authorized_keys file, and has the comment
passed in as the comment part of the key.
// PublicKey returns the public key for any private key . The public key is // suitable to be added into an authorized_keys file and has the comment // passed in as the comment part of the key .
func PublicKey(privateKey []byte, comment string) (string, error) {
	signer, err := ssh.ParsePrivateKey(privateKey)
	if err != nil {
		return "", errors.Annotate(err, "failed to load key")
	}
	auth_key := string(ssh.MarshalAuthorizedKey(signer.PublicKey()))
	auth_key = strings.TrimSpace(auth_key)
	public := fmt.Sprintf("%s %s\n", auth_key, comment)
	return public, nil
}
func PublicKey ( privateKey [ ] byte , comment string ) ( string , error ) { signer , err := ssh . ParsePrivateKey ( privateKey ) if err != nil { return " " , errors . Annotate ( err , " " ) } auth_key := string ( ssh . MarshalAuthorizedKey ( signer . PublicKey ( ) ) ) auth_key = strings . TrimSpace ( auth_key ) public := fmt . Sprintf ( " \n " , auth_key , comment ) return public , nil }
PublicKey returns the public key for any private key.
PublicKey returns the public key for any private key .
// Strip off the trailing new line so we can add a comment.