// Armor - this function returns the public part of our armored key. // @return string - This is our public key // @return error - An error can be produced when trying to access an unarmored string. func (key *Key) Armor() (string, error) { buf := new(bytes.Buffer) armor, err := armor.Encode(buf, openpgp.PublicKeyType, nil) if err != nil { return "", err } key.Serialize(armor) armor.Close() return buf.String(), nil }
// ArmorPrivate - this function returns the private part of our armored key. // @return string - This is our private key // @return error - An error can be produced when trying to access an unarmored string. func (key *Key) ArmorPrivate(config *Config) (string, error) { buf := new(bytes.Buffer) armor, err := armor.Encode(buf, openpgp.PrivateKeyType, nil) if err != nil { return "", err } c := config.Config key.SerializePrivate(armor, &c) armor.Close() return buf.String(), nil }