diff options
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/crypto.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/crypto/crypto.go b/lib/crypto/crypto.go index 8f895b42..b7afe638 100644 --- a/lib/crypto/crypto.go +++ b/lib/crypto/crypto.go @@ -31,3 +31,18 @@ func New(s string) Provider { return &pgp.Mail{} } } + +func IsEncrypted(bs *models.BodyStructure) bool { + if bs == nil { + return false + } + if bs.MIMEType == "application" && bs.MIMESubType == "pgp-encrypted" { + return true + } + for _, part := range bs.Parts { + if IsEncrypted(part) { + return true + } + } + return false +} |