konstantinullrich/crypton

Support to load a pkcs12 certificate file

Opened this issue · 1 comments

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

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