Update 'smime/smime.go'

This commit is contained in:
Marek Goc 2022-10-22 09:10:57 +00:00
parent 3f58f9a4b2
commit d9a5f65e09

View File

@ -251,19 +251,19 @@ func (smime *SMIME) Sign(msg []byte) (signedMsg []byte, err error) {
return
}
signedPart.SetHeaderField([]byte("Content-Type"), contentType[0])
contentTransferEncoding := mail.GetHeaderField([]byte("Content-Transfer-Encoding"))
if len(contentType) == 1 {
signedPart.SetHeaderField([]byte("Content-Transfer-Encoding"), contentTransferEncoding[0])
}
contentDisposition := mail.GetHeaderField([]byte("Content-Disposition"))
if len(contentType) == 1 {
signedPart.SetHeaderField([]byte("Content-Disposition"), contentDisposition[0])
}
// contentTransferEncoding := mail.GetHeaderField([]byte("Content-Transfer-Encoding"))
// if len(contentType) == 1 {
// signedPart.SetHeaderField([]byte("Content-Transfer-Encoding"), contentTransferEncoding[0])
// }
// contentDisposition := mail.GetHeaderField([]byte("Content-Disposition"))
// if len(contentType) == 1 {
// signedPart.SetHeaderField([]byte("Content-Disposition"), contentDisposition[0])
// }
// Sign
lines := mime.ParseLines(signedPart.Full())
signatureDER, err := smime.CMS.Sign(lines.Bytes(mime.CRLF), true)
// fmt.Println(signatureDER)
// Encode signature
signature := mime.MIME{}