login about faq

What is the cause of this error?

    DllDate: Aug 15 2013
    UnlockPrefix: xxx
    Username: xxx
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    inputNumBytes: 16
    modulusBitlen: 1024
      KeyType: Private
      HashInSize: 16
      modulusBitlen: 1024
      paddedInSize: 128
      Private key required, but not provided
      sigOutSize: 0
    signatureNumBytes: 0

this is my script using PowerBuilder (all declarations and results checks omitted):

loo_PubKey = loo_Cert.ExportPublicKey()

// Let's have a look at it (in XML format). mle_1.text = "Public Key from Certificate:" + loo_PubKey.GetXml() + ls_crlf mle_1.text += "SubjectDN:" + loo_Cert.SubjectDN + ls_crlf mle_1.text += "Common Name:" + loo_Cert.SubjectCN + ls_crlf mle_1.text += "Issuer Common Name:" + loo_Cert.IssuerCN + ls_crlf mle_1.text += "Serial Number:" + loo_Cert.SerialNumber + ls_crlf // -------------------------------------------------------------------- ALL IS OK

ls_PubKey = loo_PubKey.GetXml() loo_Rsa.ConnectToNewObject("Chilkat_9_5_0.Rsa") loo_Rsa.UnlockComponent("xxx") loo_Rsa.ImportPublicKey(ls_PubKey)

// just to be sure loo_Rsa.EncodingMode = "base64" loo_Rsa.OaepPadding = 0 loo_Rsa.LittleEndian = 0

ls_StrData = "xxx"

// Create an OpenSSL style signature: ls_Sig = loo_Rsa.OpenSslSignStringENC(ls_StrData)

BUT ls_Sig IS EMPTY !!!

asked Nov 26 '15 at 10:31

chilkat's gravatar image

chilkat ♦♦

The problem is that a private key is required for creating signatures. A .cer file contains only a certificate (and by default the cert's public key). It does not contain the associated private key. Typically, private keys are stored in .pfx/.p12 files, or in Java KeyStore files. (They may also be pre-installed on Windows systems.) The solution is to load the private key and call loo_Rsa.ImportPrivateKey before trying to create the signature via OpenSslSignStringENC.


answered Nov 26 '15 at 10:34

chilkat's gravatar image

chilkat ♦♦

I've got the same problem, trying to duplicate the openssl rsautl command using a .cer file.
After calling OpenSslSignString, the Rsa object return "Private key required" error to me; but using che command

openssl.exe rsautl -encrypt -in secret.txt -out secret.enc -inkey SanitelCF.cer -certin -pkcs

it works, and the certificate is the same!
How to explain this?


answered Dec 10 '15 at 04:27

b_mat_ita's gravatar image


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: Nov 26 '15 at 10:31

Seen: 576 times

Last updated: Dec 10 '15 at 04:27

powered by OSQA