login about faq

The following code fails in, but used to work fine (eg. in

CkPrivateKey key1;
assert (key1.LoadRsaDerFile (“demo512.der”));  // ok, 512 bit rsa DER key loaded 
assert (key1.SavePkcs8EncryptedFile (“secret”, ”demo512.enc”)); // ok, saved an encrypted copy
CkPrivateKey key2;
assert (key2.LoadPkcs8EncryptedFile(“demo512.enc”, “secret”); // assertion fails with

The error text says:

algorithm; des
keyLength: 192
outputSize: 22
invalid ASN.1 for unencrypted PKCS8…
Password may be incorrect.
Error_Code: 64

The demo512.enc file created using is too small; only 94 bytes vs 426 bytes when using the library. (The original demo512.der file was 319 bytes.) So it seems :SavePkcs8EncryptedFile is to blame here.

Please take a look at this,

Thanks! /Sune

asked Jul 28 '14 at 09:36

sune's gravatar image


Thanks! I'm investigating...


answered Jul 28 '14 at 16:40

chilkat's gravatar image

chilkat ♦♦

This is fixed. What build do you need (programming language, operating system, 32-bit/64-bit, etc.)?

PS> Each time a problem is fixed, the test case is added to the internal QA suite, and all tests in the QA suite must pass prior to new version releases.

PS> Also, this error was caused by improvements in keeping private keys encrypted and non-exposed when in memory.


answered Jul 28 '14 at 17:59

chilkat's gravatar image

chilkat ♦♦


I use Chilkat C/C++ Libs for VC++ 11.0 (Platform Toolset v110_xp), both 32 + 64 bit versions.

Thanks, Sune

(Jul 29 '14 at 00:34) sune

The fix is available in v9.5.0.43 here: http://www.chilkatsoft.com/downloads_vcpp.asp#downloads


answered Jul 31 '14 at 09:43

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jul 28 '14 at 09:36

Seen: 2,249 times

Last updated: Jul 31 '14 at 09:43

powered by OSQA