-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Private key not found exception (PGP, ASP.NET, XSP) #120
Comments
If you could step through the OpenPgpContext.GetSigningKey() method, that would be the best. I'm going to assume that the logic that matches the email address is working correctly (although it's possible that it's not) and that one of the other checks is more likely to be the issue. There are 3 checks that the code does and any one of them may be wrong: if (!key.IsSigningKey)
continue; var pubkey = key.PublicKey;
if (pubkey.IsRevoked ())
continue; and thirdly: long seconds = pubkey.GetValidSeconds ();
if (seconds != 0) {
var expires = pubkey.CreationTime.AddSeconds ((double) seconds);
if (expires >= DateTime.Now)
continue;
} I assume that your pgp key is probably not revoked or expired, but it might be that the code is miscalculating the expiration date and so the check fails when it shouldn't. |
Howdy, I never got to debug that method, I did however create another key/certificate, but this time with KGpg, and it worked. I suspect that probably Enigmail is doing something wrong when creating a key/certificate. either that, or that it for some reasons wouldn't handle a [email protected] address. If you wish to test it, you can create a key/certificate with the Enigmail plugin for Thunderbird, and see if you can reproduce it locally for yourself. BTW, I followed the "wizard" when starting Enigmail for the first time when creating my gmail.com key/certificate. It did however work when using my certificate/key for signing emails from Thunderbird ... BTW, how do I explicitly choose an explicit key when for instance signing a message, and I don't want to use "email lookups", but rather use the exact fingerprint (for instance) ...? I tried doing as the FAQ told me, which is to create a SecureMailboxAddress, but regardless of what I set the "name" and "email" to, it couldn't find me certificate even though I gave it the correct fingerprint ...? |
Yea, it looks like I never implemented the fingerprint lookup for PGP. I'll look into doing that. |
I had the logic backwards for checking expiration. I also added support for fingerprint lookups for PGP. |
Great!! |
Howdy, I've got this web app running on xsp web server/ubuntu, where I've implemented a GnuPGContext derived class as you show in the readme file;
Now the "pf_core_application_start" method above is basically called from Global.asax.cs when app starts, and I have verified it is invoked. And I am of course using a real email address, name and password, which I know I have a private key for, and certificate, which was created in Thunderbird using "Enigmail", but when invoked, on the line "MultipartSigned.Create", I get a "The private key could not be found" exception ...?
I've check, and the "ctx.SecretKeyRingPath" seems to be pointing in the right direction, I've tripple checked the email address, name and password (my password sink isn't even called btw), and I cannot figure out where I go wrong ...?
The last point in the stack trace, where the exception is raised, is "OpenPgpContext.GetSigningKey" ...
Suggestions ...?
The text was updated successfully, but these errors were encountered: