Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
178 views
in Technique[技术] by (71.8m points)

c# - SQLite is not available error on pkcs7.Decrypt() of MimeKit

I've encountered an error SQLite is not available while decrypting a mime message after executing pkcs7.Decrypt(). Please see my block of code below:

public MimeEntity decryptMessage(MimeMessage message)
{
    // Putting the value of message.body to a string for checking only
    using (var memory = new MemoryStream())
    {
        responseString.Body.WriteTo(memory);
        string bodystring = Encoding.UTF8.GetString(memory.ToArray());
    }

    var pkcs7 = message.Body as ApplicationPkcs7Mime;
    if (pkcs7 != null && pkcs7.SecureMimeType == SecureMimeType.EnvelopedData)
    {
        // the top-level MIME part of the message is encrypted using S/MIME
        return pkcs7.Decrypt();
    }
    else
    {
        // the top-level MIME part is not encrypted
        return message.Body;
    }
}

I've tried to put the value of message.Body into a variable and check its value but it seems that it doesn't have any problem:

Content-Type: application/pkcs7-mime; smime-type=enveloped-data;
    name=smime.p7m
Content-Disposition: attachment; filename=smime.p7m
Content-Transfer-Encoding: base64

MIAGCSqGSIb3DQEHA6CAMIACAQAxggFAMIIBPAIBADAkMBYxFDASBgNVBAMTC1NpbmFwdElR
IENBAgoeg+bBAAAAAAAMMA0GCSqGSIb3DQEBAQUABIIBAFDuM37IZePCJIuiDkwG7qV3pAJs
+e+8h2yNZJ7s4pQqV+DNUC6n+YzHVuTKLN/J4g2KObx879al6hVu2I7338fws/i9RxHmQj8P
Rfld43KTULMIsAh71ApVMF0AKyDvtWcpijSL9oVf4o6kO7rhIT2GvFO3yaMztvvtWbl5LaVw
9bDuSxA2LwVlx8kH9rXOewrH3+pchLqcKNT498WZxdwuWvwQnANUR78izIzHLgeToRIU2VFz
/X58Fzj/R2s+seKtL2J76lvsU4ubzNJj0IgRVKV1n2cx1hgmJ4qXziOdtCtmj16y71AnIILi
n2LPe1LxB8m56ekgLC/s2F+kPdowgAYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBAjfU7YPkiQm
RqC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0HmB11/2kxlE7VpF4SciD9SVsGQG0RXYW2XRGfh
E20bp5Xk9GgkOWsnUB8ykl+1MWF+G5ndAde77xwZc58rGHmHXtV2V99gtMkxjiJF38yFqb5k
MFZumMZHqvFDtRrOC4cjvDoWamUbIipSoFMStO0Qxkx9rPZophbsQoq0v6DXQz6N752kJ/X8
vSkTDeZ9u6RfzP8SBWZjc8er9VCg8m8PHMoF4FYdoh8o2/EOn29DL4vuzugJ5OHVFpt+s4QC
XNmB6WXsp9VmLuS/Q3fGoC1vvzyEC8fOAGXVl5iFLq5xYna4xSjahcozM+pYo4dDDicjFdN+
tcRZ4WBk9GbOTXeevBRZrA1wU0gOxUtOkqwBjwGRbtLgSkJbCiIakt1Qk/pj8xutA8LUuOl4
dDeqjLgTIMDxPnWnc24stCac+llwUkqC+mWZb8ygX/PfKNO2ydpTUNp9ZhkClMzeQIsMeSOr
OHJl0LO1bp9ZuIX+wJvrB2ZdmYxdwVkpfkm3JkfM8ZdBzX7kzZxMASk+pgMHQ2qzNype5nwD
H/7tLxqTlRKIf1xX6QQ49RjyqIf2IT/hByCM3SCL0URdbZyQYzf71vCRd9RpLTKOvP/hzIFc
1t7wTLW53B/TF88W1Ufa9oUAAAAAAAAAAAAA

So now I can't understand why the error says SQLite is not available despite that I'm not using any database connection on this one. I'm new to using MimeKit. If anyone knows how can I do this it will be a great help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...