-
Notifications
You must be signed in to change notification settings - Fork 100
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
Could not find any signing keys in keyring #289
Comments
Hi, the issue is likely because the path to your appsettings file will be different on your local machine than in Azure so you won't be loading any values in Azure. I'd suggest using the inbuilt configuration provider rather than a custom helper class and making it available via DI.
|
Hello @mattosaurus Thank you for your speedy response. I can confirm that it's not an issue with values not being loaded in Azure. With additional logging, I could confirm this. Full stack trace: Error: Encryption failed. [Could not find any signing keys in keyring at PgpCore.Utilities.FindBestSigningKey(PgpSecretKeyRingBundle secretKeyRingBundle) |
@mattosaurus |
Hi, @ustaalon / @Phoenix01001010. Do you have an example project that you can share with me that I can use to investigate further? |
Hi @mattosaurus I am also facing the same issue. Any update on this ? I am passing Publickeystream and private keystream from azure keyvault. I am using below code from your repository. My input output files are also in stream format. I would like to use Encyrption and signing using streams. `public PGPEncryptionKeys2(Stream publicKeyStream, Stream privateKeyStream, string passPhrase)
}` |
Hi, I've created a basic example here and all works as expected, both locally and when deployed to Azure. https://github.com/mattosaurus/PgpCore.Api If someon's able to share a project with me that replicates this issue then I'll take another look. |
Hey @mattosaurus sorry for not sharing any more details. I will try to do something over this weekend or the next one. I will try to make simple project to reproduce it, as I can't share the original code. |
Hi @ustaalon, no worries. Does the above example help you out or can you fork that to demonstrate? |
Experiencing this as well after deploying to Azure Container Job. Works fine locally. Seeing the same error as mentioned above. Downgrading to version 5.2.0 resolves this issue. Seems something changed between version which is affecting this. In my scenario am using the public and secure files as base4 strings. I can not share my code since this is a work project. |
Hi @peterasamoah7, are you able to provide an example project that can demonstrate this? I've provided a working solution above if the code there is of any help to you. |
Hey @mattosaurus I'm having a similar issue as these folks, created a GitHub repo that details the issue: https://github.com/[ragnarredbeerd/PGPKeyIssue](https://github.com/ragnarredbeerd/PGPKeyIssue) Unfortunately the code you provided in the API project does not address the issue, since it is still using a file in the project - some of the other commenters and myself are trying to use Azure Key Vault to fetch the private key. Appreciate any help you can give! |
Hi @ragnarredbeerd, thanks for creating a demo repo. Looks like it's currently private so could you please either make it public or grant me access. I think I'd missed the part about keys coming from key vault sot hat should help me investigate as well. |
Hi try this address: https://github.com/ragnarredbeerd/PGPKeyIssue The repo is public, I just signed out of GH and was still able to navigate to it. |
I am having the same problem when trying to use code in Azure that works locally on my dev machine. Locally I just put the private key string (include newlines, etc) along with the passPhrase into config settings in local secrets.json. I tried to add the same settings in my Azure App Service app settings. The app service finds the settings (or I would log an error about not getting them) but I cannot decrypt. "Could not find any signing keys in keyring" Does something else PGP-related need to be set up in Azure like I would have on my local machine where I generated the public and private keys? |
@dbockspp if you're loading from a local file then my example above should be able to help you as this works in Azure. |
Hello, so I got this working in Azure.
In my case as I already described above, my private key and public key are both stored as base64 strings in key vault and my passphrase is a string literal.
When I pull the keys from Azure Key Vault, I convert the base64 strings into streams and use the EncryptionKeys constructor that take public and private key as streams and passphrase as a string.
This fixed the issue described in my original post. I'm not sure why but this solved my headache. Hope this helps.
…________________________________
From: mattosaurus ***@***.***>
Sent: Sunday, February 2, 2025 9:47:51 PM
To: mattosaurus/PgpCore ***@***.***>
Cc: Peter Asamoah ***@***.***>; Mention ***@***.***>
Subject: Re: [mattosaurus/PgpCore] Could not find any signing keys in keyring (Issue #289)
@dbockspp<https://github.com/dbockspp> if you're loading from a local file then my example above should be able to help you as this works in Azure.
https://github.com/mattosaurus/PgpCore.Api
—
Reply to this email directly, view it on GitHub<#289 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALLQMFQ2YXSG5OIVNHOMXJT2N2HAPAVCNFSM6AAAAABHXBD7RKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRZGU3TANJYHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hello, I have used the Pgpcore 6.3.1 library in my project to sign and encrypt a string. The code works fine locally, but when deployed as a web app on Azure, I am encountering an error: "Could not find any signing keys in the keyring." I have been reading the keys from the appsettings file for now and passing them as a string (I also tried using a memory stream), but none of these methods are working. Could someone please help me identify the possible root cause?
string? publicKey = Helper.GetAppSettings("KeyConfig:PublicKey");
string? privateKey = Helper.GetAppSettings("KeyConfig:PrivateKey");
EncryptionKeys signingKey = new(publicKey, privateKey, passphrase); -Error line
The text was updated successfully, but these errors were encountered: