more cleanup, fixes

This commit is contained in:
Sanjana Rajan 2018-06-04 17:50:26 -07:00
parent c254bd5d44
commit 04ebe6d459
9 changed files with 33 additions and 53 deletions

View file

@ -14,7 +14,7 @@ import (
func (o *OpenPGP) EncryptAttachmentBinKey(plainData []byte, fileName string, publicKey []byte) (*EncryptedSplit, error) {
var outBuf bytes.Buffer
w, err := armor.Encode(&outBuf, pgpMessageType.string(), armorHeader)
w, err := armor.Encode(&outBuf, pgpMessageType, armorHeader)
if err != nil {
return nil, err
}
@ -35,12 +35,12 @@ func (o *OpenPGP) EncryptAttachmentBinKey(plainData []byte, fileName string, pub
ew.Close()
w.Close()
splited, err := SeparateKeyAndData(outBuf.String())
split, err := SeparateKeyAndData(outBuf.String())
if err != nil {
return nil, err
}
splited.Algo = "aes256"
return splited, nil
split.Algo = "aes256"
return split, nil
}
//EncryptAttachment ...
@ -109,7 +109,7 @@ func (o *OpenPGP) DecryptAttachment(keyPacket []byte, dataPacket []byte, private
func (o *OpenPGP) EncryptAttachmentWithPassword(plainData []byte, password string) (string, error) {
var outBuf bytes.Buffer
w, err := armor.Encode(&outBuf, pgpMessageType.string(), armorHeader)
w, err := armor.Encode(&outBuf, pgpMessageType, armorHeader)
if err != nil {
return "", err
}