Author Topic: Unrecognized OID when loading private key  (Read 1098 times)

lukasz

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Unrecognized OID when loading private key
« on: January 28, 2018, 04:30:04 PM »
Hi, I try to use chilkat library to load encrypted private key using method:

But I got error:

Code: [Select]
ChilkatLog:
  LoadPemFile:
    DllDate: Jan 12 2018
    ChilkatVersion: 9.5.0.71
    UnlockPrefix: Anything for 30-day trial
    Architecture: Little Endian; 32-bit
    Language: .NET 4.6
    VerboseLogging: 1
    path: C:\Users\Lukasz\Desktop\TestKeystore\TestKeystore.key
    loadPem:
      itemType: ENCRYPTED PRIVATE KEY
      addPemItem:
        itemType: ENCRYPTED PRIVATE KEY
        loadAnyDerPw:
          pkcs8AsnToKey:
            pbes1...
            Unrecognized OID
            oid: 1.2.840.113549.1.12.1.1
          --pkcs8AsnToKey
        --loadAnyDerPw
        Failed to load private key...
      --addPemItem
      No more -----BEGIN's found.
    --loadPem
    Failed.
  --LoadPemFile
--ChilkatLog

I know that this private key is ok, because I can load it using BouncyCastle, but I'm unable to do it using Chilkat library. What am I doing wrong? Generally I want to create key pair entry and save it to JKS file (now I'm using BouncyCastle to generate PFX).

Chilkat

  • Administrator
  • Full Member
  • *****
  • Posts: 103
  • Karma: +6/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #1 on: January 29, 2018, 10:06:03 AM »
Thanks.  I'll provide a fix..

If an OID is unrecognized, one can Google the OID to see what it is.  For example, search for "1.2.840.113549.1.12.1.1" and you'll get results pointing to the  alvestrand.no  page for the OID, such as here:  http://www.alvestrand.no/objectid/1.2.840.113549.1.12.1.1.html

This OID is for PBES1 w/ RC4.  Given that Chilkat already implements PBES1 and RC4, the fix is to just (internally) add this OID to the list of recognized OIDs.  (Somehow it was missed...)

I'll post a download URL with the fix when ready. 

Chilkat

  • Administrator
  • Full Member
  • *****
  • Posts: 103
  • Karma: +6/-0
    • View Profile

lukasz

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #3 on: January 29, 2018, 12:20:50 PM »
Thank you for quick help!
I will check and let you know if something will go wrong.

lukasz

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #4 on: January 30, 2018, 03:45:19 AM »
I have one more question (important from our client perspective):
When this change will be available in stable release?

lukasz

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #5 on: January 30, 2018, 11:05:52 AM »
Here's an update with the fix:

https://chilkatdownload.com/prerelease/chilkatdotnet46-9.5.0-win32-372.zip
https://chilkatdownload.com/prerelease/chilkatdotnet46-9.5.0-x64-373.zip

Note: These links are not permanent.

We've tried version version provided above and got another error for the same private key file:

Code: [Select]
ChilkatLog:
  LoadPemFile:
    DllDate: Jan 29 2018
    ChilkatVersion: 9.5.0.71
    UnlockPrefix: Anything for 30-day trial
    Architecture: Little Endian; 32-bit
    Language: .NET 4.6
    VerboseLogging: 1
    path: C:\Users\Lukasz\Desktop\TestKeystore\TestKeystore.key
    loadPem:
      itemType: ENCRYPTED PRIVATE KEY
      addPemItem:
        itemType: ENCRYPTED PRIVATE KEY
        loadAnyDerPw:
          pkcs8AsnToKey:
            pbes1...
          --pkcs8AsnToKey
        --loadAnyDerPw
        Failed to load private key...
      --addPemItem
      No more -----BEGIN's found.
    --loadPem
    Failed.
  --LoadPemFile
--ChilkatLog

What could be wrong with this file? Of course this file is properly processed by another library that we are using.

Chilkat

  • Administrator
  • Full Member
  • *****
  • Posts: 103
  • Karma: +6/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #6 on: January 30, 2018, 11:44:38 AM »
Thanks. 

To fix the problem, I'll need a sample key w/ password (assuming you're providing the key in a pfx or other format that requires a password).  You can send it to support@chilkatsoft.com

PS> Yes, all fixes and modifications/improvements are always rolled into the next official version released.

lukasz

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Unrecognized OID when loading private key
« Reply #7 on: January 31, 2018, 07:01:16 AM »
Ok, I've just sent the private key file.

Chilkat

  • Administrator
  • Full Member
  • *****
  • Posts: 103
  • Karma: +6/-0
    • View Profile