Skip to content
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

Support to load a pkcs12 certificate file #37

Open
reinies opened this issue Apr 19, 2023 · 1 comment
Open

Support to load a pkcs12 certificate file #37

reinies opened this issue Apr 19, 2023 · 1 comment

Comments

@reinies
Copy link

reinies commented Apr 19, 2023

Hello Konstantin,

I would like to use your library and am currently stuck on loading an existing certificate (with private and public key). I would like to make a signature with the private key based on SHA256withECDSA. Unfortunately, I have not found a way to load an existing file with password.

Code example of what I am thinking of:

// Load the PKCS12 file
  File pkcs12File = File('path/to/your/pkcs12/file.p12');
  Uint8List pkcs12Data = await pkcs12File.readAsBytes();

  // Decrypt the PKCS12 file using the password
  String pkcs12Password = 'your_password_here';
  ECKeypair p12EccKeyPair =  ECKeypair.fromPKCS12(pkcs12Data, pkcs12Password);

  // Get the private key for signature
  ECPrivateKey privateKey = p12EccKeyPair.privateKey;
  ...

I only saw that you support "fromPEM for RSA Keys.

Is there a other way to load a pkcs12?

Best regards,
Reinhard

@konstantinullrich
Copy link
Owner

Hey Reinhard,

currently, there is no support for pkcs12. I'll have a look if/how the underlying library supports pkcs12 and get back to you as soon as possible

Best regards,
Konsti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants