I'm calling to post a request on the new-account URL after getting the new-account URL from the response to the directory request "https://acme-staging-v02.api.letsencrypt.org/directory" and the new-nonce request header for JWS.
I don't know what's wrong with your request. It seems likely something is wrong with the way your signature was constructed. In your code, can you validate your own signature before sending the request?
I do have a suggestion. If you are developing a new client, I would suggest running a copy of Pebble:
Then you can examine both "ends" of the connection, including adding debuggers or extra print statements to pebble as needed. It seems like for this particular case of an invalid signature, it may also have more verbose errors.
I'm sharing the console app GitHub repo of this topic, to continue to resolve my issue by checking all the code for signature generation and other stuff where I'm doing wrong things.
You call SignData without specifying the padding. It's not clear to me from the .NET documentation whether this defaults to PKCS#1 padding or not. You may need to specify it?
I am not sure that this is the problem. At the end of each line there is a "carriage return" character, like DOS file format. May be removing those helps?
Output filtered by the cat -te command:
I did not say it didn't matter. The fact it shouldn't matter is something different than it doesn't matter. Other implementations of JWS might not be RFC compliant.
Guys, you may have my permission to use my GitHub public repo AshfaqAliZardariOfficial/ ServerManagerConsoleApp for code correction and then make a pull request. I'll be thankful for who will solve my topic issue. Thank you
I just meant that even though a carriage return is a valid JSON whitespace, implementations such as used by the Le'ts Encrypt validation server might behave not conforming to the RFC and decide a carriage return is invalid. My point was: even though a carriage return is valid, it might be useful to see if your code suddenly works without including carriage return characters.
I strongly suggest you adopt a "Test Driven Development" approach to your project. Between reading the ACME RFC and using other clients (like Certbot), you should be able to develop some unit tests to ensure you create payloads in the correct format. You can then create some integrated tests that run against the Pebble server, as suggested above.