Skip to content

Commit

Permalink
add c# endpoint example
Browse files Browse the repository at this point in the history
Differential Revision: D66679184

fbshipit-source-id: f935f04ff278279e63bd90a4686531c407f7d446
  • Loading branch information
Gaafar authored and facebook-github-bot committed Dec 4, 2024
1 parent d744efa commit dbac257
Show file tree
Hide file tree
Showing 7 changed files with 681 additions and 0 deletions.
Loading

1 comment on commit dbac257

@PlanexNova
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you? While testing with your code, I found that the “Bouncy Castle Cryptography” library apparently has some problem when working with the decryption of the private pen file, in this fragment of the code it fails:

        if (procType == “4,ENCRYPTED”)
        {
            if (pFinder == null)
                throw new PasswordException(“No password finder specified, but a password is required”);

            char[] password = pFinder.GetPassword();
            if (password == null)
                throw new PasswordException(“Password is null, but a password is required”); //Here!

So it always usually throws:
throw new CryptographicException(“The provided PEM does not contain a valid RSA private key.”);

Can you think of a solution to this? How could I make it work?

Fuentes:

Line 253
https://github.com/bcgit/bc-csharp/blob/b9ac9fffc29164740527ec77a7ca4e539a8c7026/crypto/src/openssl/PEMReader.cs#L254

https://github.com/bcgit/bc-csharp/tree/b9ac9fffc29164740527ec77a7ca4e539a8c7026

Please sign in to comment.