Ejemplo n.º 1
0
        public void UnicodeUtf8PageTest()
        {
            var clear = @"Hi Meddington,

i think i have found the issue.
I write this mail as - only text - message.
If another receive this email, my signature email and webaddress are i
nterpreted as links and will be changed by outlook to html elements.


Mit freundlichen Grüßen,
Sebastian Lutz

Baebeca Solutions - Lutz
E-Mail: [email protected]
Tel. Büro: 02261 - 9202935
Tel. Mobil: 0171 - 6431821
Web: https://www.baebeca.de
PGP Key: 0x5AD0240C
";

            var context = new CryptoContext(GetPasswordCallback, Pubring, Secring, "rsa", "sha-1");
            var crypto  = new PgpCrypto(context);

            var clearSig = crypto.SignClear(clear, "*****@*****.**", Encoding.UTF8, new Dictionary <string, string>());
            var ret      = crypto.VerifyClear(Encoding.UTF8.GetBytes(clearSig));

            Assert.IsTrue(ret);
        }
	    private Signature VerifyClearSignature(ref CryptoContext context, PgpCrypto crypto, string clearsig)
	    {
		    var signature = new Signature();

		    try
		    {
			    var valid = crypto.VerifyClear(_encoding.GetBytes(clearsig));
			    context = crypto.Context;
			    signature.Valid = valid;
			    signature.KeyId = context.SignedByKeyId;
			    signature.UserId = context.SignedByUserId;
		    }
		    catch (PublicKeyNotFoundException ex)
		    {
			    Logger.Debug(ex.ToString());

			    return null;
		    }
		    catch (Exception ex)
		    {
			    Logger.Debug(ex.ToString());

			    Passphrase = null;

			    WriteErrorData("VerifyEmail", ex);
			    ShowErrorBox(ex.Message);
			    return null;
		    }

		    return signature;
	    }
Ejemplo n.º 3
0
        public void VerifyEmail()
        {
            var asc      = @"-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

i think i have found the issue.
I write this mail as - only text - message.
If another receive this email, my signature email and webaddress are i

nterpreted as links and will be changed by outlook to html elements.


Mit freundlichen Grüßen,
Sebastian Lutz

Baebeca Solutions - Lutz
E-Mail: [email protected] <mailto:[email protected]> Tel. Büro: 02261 - 9202935 Tel. Mobil: 0171 - 6431821
Web: https://www.baebeca.de <https://www.baebeca.de> PGP Key: 0x5AD0240C

-----BEGIN PGP SIGNATURE-----

iQEcBAEBCAAGBQJWPGGdAAoJEEKN+AfqKr312lEIAJ6i2C/8ZWoU3K2T0JWUXLRJ
Rycl2f9IqZkTOA4/x39QX+MuJ8N20ek5YDDeljZZdZnuEkBKvWZUZ/E6f49JJv6p
MBpNZgPua13fjERPIlNNV5CLxXDqhaH+jFaP8hCzthuNMKuW4iPy2wppX4f+EXbH
O5NMNUOtwD149S8y3DDx90Y6RdvQL9HYijDzHHpko1RqRL2lrkxrzOyTk0R0JoS2
C4h6ab6bixbmV6QBCtzOFpp6nkxWT27CFRIN0yz9t6psGZQgEVYP7RQlmFqS0jr4
9pTfjB6djoxrLxNiQMHsaH0UKeC+3AQdfvAloaIljULuBfa9BV8U5CXJBy1JUiM=
=K83z
-----END PGP SIGNATURE-----
";
            var context  = new CryptoContext(GetPasswordCallback, Pubring, Secring, "rsa", "sha-1");
            var crypto   = new PgpCrypto(context);
            var encoding = Encoding.GetEncoding(28591);

            var ret = crypto.VerifyClear(encoding.GetBytes(asc));

            Assert.IsTrue(ret);
        }