Update 'smime/smime.go'
This commit is contained in:
parent
3f58f9a4b2
commit
d9a5f65e09
@ -1,6 +1,6 @@
|
|||||||
//Package smime implants parts of the S/MIME 4.0 specification rfc5751-bis-12.
|
// Package smime implants parts of the S/MIME 4.0 specification rfc5751-bis-12.
|
||||||
//
|
//
|
||||||
//See https://www.ietf.org/id/draft-ietf-lamps-rfc5751-bis-12.txt
|
// See https://www.ietf.org/id/draft-ietf-lamps-rfc5751-bis-12.txt
|
||||||
package smime
|
package smime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -251,19 +251,19 @@ func (smime *SMIME) Sign(msg []byte) (signedMsg []byte, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
signedPart.SetHeaderField([]byte("Content-Type"), contentType[0])
|
signedPart.SetHeaderField([]byte("Content-Type"), contentType[0])
|
||||||
contentTransferEncoding := mail.GetHeaderField([]byte("Content-Transfer-Encoding"))
|
// contentTransferEncoding := mail.GetHeaderField([]byte("Content-Transfer-Encoding"))
|
||||||
if len(contentType) == 1 {
|
// if len(contentType) == 1 {
|
||||||
signedPart.SetHeaderField([]byte("Content-Transfer-Encoding"), contentTransferEncoding[0])
|
// signedPart.SetHeaderField([]byte("Content-Transfer-Encoding"), contentTransferEncoding[0])
|
||||||
}
|
// }
|
||||||
contentDisposition := mail.GetHeaderField([]byte("Content-Disposition"))
|
// contentDisposition := mail.GetHeaderField([]byte("Content-Disposition"))
|
||||||
if len(contentType) == 1 {
|
// if len(contentType) == 1 {
|
||||||
signedPart.SetHeaderField([]byte("Content-Disposition"), contentDisposition[0])
|
// signedPart.SetHeaderField([]byte("Content-Disposition"), contentDisposition[0])
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Sign
|
// Sign
|
||||||
lines := mime.ParseLines(signedPart.Full())
|
lines := mime.ParseLines(signedPart.Full())
|
||||||
signatureDER, err := smime.CMS.Sign(lines.Bytes(mime.CRLF), true)
|
signatureDER, err := smime.CMS.Sign(lines.Bytes(mime.CRLF), true)
|
||||||
|
// fmt.Println(signatureDER)
|
||||||
// Encode signature
|
// Encode signature
|
||||||
|
|
||||||
signature := mime.MIME{}
|
signature := mime.MIME{}
|
||||||
|
Loading…
Reference in New Issue
Block a user