mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-23 10:26:44 +00:00
rename
This commit is contained in:
@ -291,7 +291,7 @@ func signAttachment(encrypter *crypto.KeyRing, data io.Reader) (signature io.Rea
|
||||
return bytes.NewReader(sig.GetBinary()), nil
|
||||
}
|
||||
|
||||
func createPackets(
|
||||
func encryptAndEncodeSessionKeys(
|
||||
pubkey *crypto.KeyRing,
|
||||
bodyKey *crypto.SessionKey,
|
||||
attkeys map[string]*crypto.SessionKey,
|
||||
@ -315,7 +315,7 @@ func createPackets(
|
||||
return
|
||||
}
|
||||
|
||||
func encryptSymmetric(
|
||||
func encryptSymmDecryptKey(
|
||||
kr *crypto.KeyRing,
|
||||
textToEncrypt string,
|
||||
) (decryptedKey *crypto.SessionKey, symEncryptedData []byte, err error) {
|
||||
|
||||
@ -24,13 +24,14 @@ import (
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
)
|
||||
|
||||
// Draft actions
|
||||
const (
|
||||
DraftActionReply = 0
|
||||
DraftActionReplyAll = 1
|
||||
DraftActionForward = 2
|
||||
)
|
||||
|
||||
// Message package types.
|
||||
// Message send package types.
|
||||
const (
|
||||
InternalPackage = 1
|
||||
EncryptedOutsidePackage = 2
|
||||
@ -40,13 +41,14 @@ const (
|
||||
ClearMIMEPackage = 32
|
||||
)
|
||||
|
||||
// Signature types.
|
||||
// Send signature types.
|
||||
const (
|
||||
SignatureNone = 0
|
||||
SignatureDetached = 1
|
||||
SignatureAttachedArmored = 2
|
||||
)
|
||||
|
||||
// DraftReq defines paylod for creating drafts
|
||||
type DraftReq struct {
|
||||
Message *Message
|
||||
ParentID string `json:",omitempty"`
|
||||
@ -78,18 +80,18 @@ type AlgoKey struct {
|
||||
|
||||
type MessageAddress struct {
|
||||
Type int
|
||||
BodyKeyPacket string // base64-encoded key packet.
|
||||
Signature int // 0 = None, 1 = Detached, 2 = Attached/Armored
|
||||
AttachmentKeyPackets map[string]string
|
||||
EncryptedBodyKeyPacket string `json:"BodyKeyPacket"` // base64-encoded key packet.
|
||||
Signature int
|
||||
EncryptedAttachmentKeyPackets map[string]string `json:"AttachmentKeyPackets"`
|
||||
}
|
||||
|
||||
type MessagePackage struct {
|
||||
Addresses map[string]*MessageAddress
|
||||
Type int
|
||||
MIMEType string
|
||||
Body string // base64-encoded encrypted data packet.
|
||||
BodyKey AlgoKey // base64-encoded session key (only if cleartext recipients).
|
||||
AttachmentKeys map[string]AlgoKey // Only include if cleartext & attachments.
|
||||
EncryptedBody string `json:"Body"` // base64-encoded encrypted data packet.
|
||||
DecryptedBodyKey AlgoKey `json:"BodyKey"` // base64-encoded session key (only if cleartext recipients).
|
||||
DecryptedAttachmentKeys map[string]AlgoKey `json:"AttachmentKeys"` // Only include if cleartext & attachments.
|
||||
}
|
||||
|
||||
func newMessagePackage(
|
||||
@ -97,7 +99,7 @@ func newMessagePackage(
|
||||
attKeys map[string]AlgoKey,
|
||||
) (pkg *MessagePackage) {
|
||||
pkg = &MessagePackage{
|
||||
Body: base64.StdEncoding.EncodeToString(send.data),
|
||||
EncryptedBody: base64.StdEncoding.EncodeToString(send.ciphertext),
|
||||
Addresses: send.addressMap,
|
||||
MIMEType: send.contentType,
|
||||
Type: send.sharedScheme,
|
||||
@ -105,23 +107,23 @@ func newMessagePackage(
|
||||
|
||||
if send.sharedScheme&ClearPackage == ClearPackage ||
|
||||
send.sharedScheme&ClearMIMEPackage == ClearMIMEPackage {
|
||||
pkg.BodyKey.Key = send.key.GetBase64Key()
|
||||
pkg.BodyKey.Algorithm = send.key.Algo
|
||||
pkg.DecryptedBodyKey.Key = send.decryptedBodyKey.GetBase64Key()
|
||||
pkg.DecryptedBodyKey.Algorithm = send.decryptedBodyKey.Algo
|
||||
}
|
||||
|
||||
if attKeys != nil && send.sharedScheme&ClearPackage == ClearPackage {
|
||||
pkg.AttachmentKeys = attKeys
|
||||
pkg.DecryptedAttachmentKeys = attKeys
|
||||
}
|
||||
|
||||
return pkg
|
||||
}
|
||||
|
||||
type sendData struct {
|
||||
key *crypto.SessionKey //body session key
|
||||
decryptedBodyKey *crypto.SessionKey //body session key
|
||||
addressMap map[string]*MessageAddress
|
||||
sharedScheme int
|
||||
data []byte // ciphertext
|
||||
body string // cleartext
|
||||
ciphertext []byte
|
||||
cleartext string
|
||||
contentType string
|
||||
}
|
||||
|
||||
@ -148,9 +150,9 @@ func NewSendMessageReq(
|
||||
req.plain.addressMap = make(map[string]*MessageAddress)
|
||||
req.rich.addressMap = make(map[string]*MessageAddress)
|
||||
|
||||
req.mime.body = mimeBody
|
||||
req.plain.body = plainBody
|
||||
req.rich.body = richBody
|
||||
req.mime.cleartext = mimeBody
|
||||
req.plain.cleartext = plainBody
|
||||
req.rich.cleartext = richBody
|
||||
|
||||
req.attKeys = attKeys
|
||||
req.kr = kr
|
||||
@ -219,8 +221,8 @@ func (req *SendMessageReq) addNonMIMERecipient(
|
||||
return errMultipartInNonMIME
|
||||
}
|
||||
|
||||
if send.key == nil {
|
||||
if send.key, send.data, err = encryptSymmetric(req.kr, send.body); err != nil {
|
||||
if send.decryptedBodyKey == nil {
|
||||
if send.decryptedBodyKey, send.ciphertext, err = encryptSymmDecryptKey(req.kr, send.cleartext); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -237,7 +239,7 @@ func (req *SendMessageReq) addNonMIMERecipient(
|
||||
}
|
||||
|
||||
if doEncrypt {
|
||||
newAddress.BodyKeyPacket, newAddress.AttachmentKeyPackets, err = createPackets(pubkey, send.key, req.attKeys)
|
||||
newAddress.EncryptedBodyKeyPacket, newAddress.EncryptedAttachmentKeyPackets, err = encryptAndEncodeSessionKeys(pubkey, send.decryptedBodyKey, req.attKeys)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -254,8 +256,8 @@ func (req *SendMessageReq) addMIMERecipient(
|
||||
) (err error) {
|
||||
|
||||
req.mime.contentType = ContentTypeMultipartMixed
|
||||
if req.mime.key == nil {
|
||||
if req.mime.key, req.mime.data, err = encryptSymmetric(req.kr, req.mime.body); err != nil {
|
||||
if req.mime.decryptedBodyKey == nil {
|
||||
if req.mime.decryptedBodyKey, req.mime.ciphertext, err = encryptSymmDecryptKey(req.kr, req.mime.cleartext); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -267,11 +269,11 @@ func (req *SendMessageReq) addMIMERecipient(
|
||||
// Attachment keys are not needed because attachments are part
|
||||
// of MIME body and therefore attachments are encrypted with
|
||||
// body session key.
|
||||
mimeBodyPacket, _, err := createPackets(pubkey, req.mime.key, map[string]*crypto.SessionKey{})
|
||||
mimeBodyPacket, _, err := encryptAndEncodeSessionKeys(pubkey, req.mime.decryptedBodyKey, map[string]*crypto.SessionKey{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.mime.addressMap[email] = &MessageAddress{Type: sendScheme, BodyKeyPacket: mimeBodyPacket, Signature: signature}
|
||||
req.mime.addressMap[email] = &MessageAddress{Type: sendScheme, EncryptedBodyKeyPacket: mimeBodyPacket, Signature: signature}
|
||||
} else {
|
||||
req.mime.addressMap[email] = &MessageAddress{Type: sendScheme, Signature: signature}
|
||||
}
|
||||
|
||||
@ -76,19 +76,19 @@ func (td *testData) prepareAndCheck(t *testing.T) {
|
||||
r.True(ok, "pkg %d email %s", i, email)
|
||||
|
||||
r.Equal(wantAddress.Type, haveAddress.Type, "pkg %d email %s", i, email)
|
||||
shouldBeEmpty(wantAddress.BodyKeyPacket)(t, haveAddress.BodyKeyPacket, "pkg %d email %s", i, email)
|
||||
shouldBeEmpty(wantAddress.EncryptedBodyKeyPacket)(t, haveAddress.EncryptedBodyKeyPacket, "pkg %d email %s", i, email)
|
||||
r.Equal(wantAddress.Signature, haveAddress.Signature, "pkg %d email %s", i, email)
|
||||
|
||||
if len(td.attKeys) == 0 {
|
||||
r.Len(haveAddress.AttachmentKeyPackets, 0)
|
||||
r.Len(haveAddress.EncryptedAttachmentKeyPackets, 0)
|
||||
} else {
|
||||
r.Equal(
|
||||
len(wantAddress.AttachmentKeyPackets),
|
||||
len(haveAddress.AttachmentKeyPackets),
|
||||
len(wantAddress.EncryptedAttachmentKeyPackets),
|
||||
len(haveAddress.EncryptedAttachmentKeyPackets),
|
||||
"pkg %d email %s", i, email,
|
||||
)
|
||||
for attID, wantAttKey := range wantAddress.AttachmentKeyPackets {
|
||||
haveAttKey, ok := haveAddress.AttachmentKeyPackets[attID]
|
||||
for attID, wantAttKey := range wantAddress.EncryptedAttachmentKeyPackets {
|
||||
haveAttKey, ok := haveAddress.EncryptedAttachmentKeyPackets[attID]
|
||||
r.True(ok, "pkg %d email %s att %s", i, email, attID)
|
||||
shouldBeEmpty(wantAttKey)(t, haveAttKey, "pkg %d email %s att %s", i, email, attID)
|
||||
}
|
||||
@ -98,24 +98,24 @@ func (td *testData) prepareAndCheck(t *testing.T) {
|
||||
r.Equal(wantPackage.Type, havePackage.Type, "pkg %d", i)
|
||||
r.Equal(wantPackage.MIMEType, havePackage.MIMEType, "pkg %d", i)
|
||||
|
||||
shouldBeEmpty(wantPackage.Body)(t, havePackage.Body, "pkg %d", i)
|
||||
shouldBeEmpty(wantPackage.EncryptedBody)(t, havePackage.EncryptedBody, "pkg %d", i)
|
||||
|
||||
wantBodyKey := wantPackage.BodyKey
|
||||
haveBodyKey := havePackage.BodyKey
|
||||
wantBodyKey := wantPackage.DecryptedBodyKey
|
||||
haveBodyKey := havePackage.DecryptedBodyKey
|
||||
|
||||
shouldBeEmpty(wantBodyKey.Algorithm)(t, haveBodyKey.Algorithm, "pkg %d", i)
|
||||
shouldBeEmpty(wantBodyKey.Key)(t, haveBodyKey.Key, "pkg %d", i)
|
||||
|
||||
if len(td.attKeys) == 0 {
|
||||
r.Len(havePackage.AttachmentKeys, 0)
|
||||
r.Len(havePackage.DecryptedAttachmentKeys, 0)
|
||||
} else {
|
||||
r.Equal(
|
||||
len(wantPackage.AttachmentKeys),
|
||||
len(havePackage.AttachmentKeys),
|
||||
len(wantPackage.DecryptedAttachmentKeys),
|
||||
len(havePackage.DecryptedAttachmentKeys),
|
||||
"pkg %d", i,
|
||||
)
|
||||
for attID, wantAttKey := range wantPackage.AttachmentKeys {
|
||||
haveAttKey, ok := havePackage.AttachmentKeys[attID]
|
||||
for attID, wantAttKey := range wantPackage.DecryptedAttachmentKeys {
|
||||
haveAttKey, ok := havePackage.DecryptedAttachmentKeys[attID]
|
||||
r.True(ok, "pkg %d att %s", i, attID)
|
||||
shouldBeEmpty(wantAttKey.Key)(t, haveAttKey.Key, "pkg %d att %s", i, attID)
|
||||
shouldBeEmpty(wantAttKey.Algorithm)(t, haveAttKey.Algorithm, "pkg %d att %s", i, attID)
|
||||
@ -151,13 +151,13 @@ func TestSendReq(t *testing.T) {
|
||||
"html@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -171,13 +171,13 @@ func TestSendReq(t *testing.T) {
|
||||
"plain@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -202,38 +202,38 @@ func TestSendReq(t *testing.T) {
|
||||
"internal1@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"internal3@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
"internal2@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"internal4@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -252,9 +252,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -272,9 +272,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -292,8 +292,8 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -311,8 +311,8 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -345,8 +345,8 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
@ -357,9 +357,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
@ -370,9 +370,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -387,12 +387,12 @@ func TestSendReq(t *testing.T) {
|
||||
"mime@gpg.com": {
|
||||
Type: PGPMIMEPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
},
|
||||
},
|
||||
Type: PGPMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -406,13 +406,13 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-plain@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -426,13 +426,13 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-html@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -458,38 +458,38 @@ func TestSendReq(t *testing.T) {
|
||||
"mime@gpg.com": {
|
||||
Type: PGPMIMEPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
},
|
||||
},
|
||||
Type: PGPMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
"inline-plain@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
"inline-html@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -505,19 +505,19 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-html@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"internal@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage | InternalPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -532,19 +532,19 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-plain@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"internal@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage | InternalPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
EncryptedBody: "non-empty",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -559,8 +559,8 @@ func TestSendReq(t *testing.T) {
|
||||
"internal@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"html@email.com": {
|
||||
Type: ClearPackage,
|
||||
@ -569,9 +569,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: InternalPackage | ClearPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -586,8 +586,8 @@ func TestSendReq(t *testing.T) {
|
||||
"internal@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"html@email.com": {
|
||||
Type: ClearPackage,
|
||||
@ -596,9 +596,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: InternalPackage | ClearPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -613,8 +613,8 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-html@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"html@email.com": {
|
||||
Type: ClearPackage,
|
||||
@ -623,9 +623,9 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: PGPInlinePackage | ClearPackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -644,15 +644,15 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-plain@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: PGPInlinePackage | ClearPackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -667,7 +667,7 @@ func TestSendReq(t *testing.T) {
|
||||
"mime@gpg.com": {
|
||||
Type: PGPMIMEPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
},
|
||||
"signed@email.com": {
|
||||
Type: ClearMIMEPackage,
|
||||
@ -676,8 +676,8 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage | PGPMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -692,7 +692,7 @@ func TestSendReq(t *testing.T) {
|
||||
"mime@gpg.com": {
|
||||
Type: PGPMIMEPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
},
|
||||
"mime@email.com": { // can this be combined ?
|
||||
Type: ClearMIMEPackage,
|
||||
@ -701,8 +701,8 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage | PGPMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -726,7 +726,7 @@ func TestSendReq(t *testing.T) {
|
||||
"mime@gpg.com": {
|
||||
Type: PGPMIMEPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
},
|
||||
"mime@email.com": {
|
||||
Type: ClearMIMEPackage,
|
||||
@ -739,16 +739,16 @@ func TestSendReq(t *testing.T) {
|
||||
},
|
||||
Type: ClearMIMEPackage | PGPMIMEPackage,
|
||||
MIMEType: ContentTypeMultipartMixed,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
"plain@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"plain@email.com": {
|
||||
Type: ClearPackage,
|
||||
@ -757,23 +757,23 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-plain@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage | ClearPackage | PGPInlinePackage,
|
||||
MIMEType: ContentTypePlainText,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
{
|
||||
Addresses: map[string]*MessageAddress{
|
||||
"html@pm.me": {
|
||||
Type: InternalPackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "not-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "not-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
"html@email.com": {
|
||||
Type: ClearPackage,
|
||||
@ -782,15 +782,15 @@ func TestSendReq(t *testing.T) {
|
||||
"inline-html@gpg.com": {
|
||||
Type: PGPInlinePackage,
|
||||
Signature: SignatureDetached,
|
||||
BodyKeyPacket: "non-empty",
|
||||
AttachmentKeyPackets: attKeyPackets,
|
||||
EncryptedBodyKeyPacket: "non-empty",
|
||||
EncryptedAttachmentKeyPackets: attKeyPackets,
|
||||
},
|
||||
},
|
||||
Type: InternalPackage | ClearPackage | PGPInlinePackage,
|
||||
MIMEType: ContentTypeHTML,
|
||||
Body: "non-empty",
|
||||
BodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
AttachmentKeys: attAlgoKeys,
|
||||
EncryptedBody: "non-empty",
|
||||
DecryptedBodyKey: AlgoKey{"non-empty", "non-empty"},
|
||||
DecryptedAttachmentKeys: attAlgoKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user