Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3933212
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:34:30+00:00 2026-05-19T23:34:30+00:00

I am trying to port the AquaticPrime framework for Mac to Windows. On the

  • 0

I am trying to port the AquaticPrime framework for Mac to Windows.

On the Mac, it uses the opensll library, and I try to understand how to port this to Windows, where I have to use the CryptoAPI, I guess.

I mainly need the code for validation of the generated signature with a given public key.

Here’s how verification is done with openssl:

  1. inputs: license data, public key and signature, both 128 bytes long.
  2. A SHA1 digest is calculated from the license data.
  3. A RSA context is set up with the public key data
  4. RSA_public_decrypt() is called, given the RSA key and the signature, which returns a 20 byte long SHA1 digest – is this digest equal the one from step 2, the signature is valid.

So, how do I do this with CryptoAPI? I’ve gotten this far:

  1. Start with CryptAcquireContext(ctx, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)
  2. Use CryptImportKey with the help of this posting, with pubexp=3 and bitlen=1024. That all works, i.e. I get no errors, and I looked at the binary data to verify that it matches what the MSDN article shows.
  3. Create a SHA1 digest from the license data. I’ve retrieved the resulting 20 byte hash value and see that it matches what I get with openssl on the Mac.

At this point, I call:

CryptVerifySignature (hashHdl, sig, sigLen, keyHdl, 0, 0)

This fails with error code ERROR_INVALID_PARAMETER.

The odd thing is that when I first accidentally had stored a twice as large public key into the PUBLICKEYBLOB structure, I received a NTE_BAD_SIGNATURE error instead. This might suggest that now the public key I am passing is correct.

Why the ERROR_INVALID_PARAMETER error now, then? I’ve verified that the hash value is correct, and the key appears to be accepted, too. And the “sig” parameter is just a pointer to the 128 bytes of the signature, and sigLen is 128.

So, what am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:34:31+00:00Added an answer on May 19, 2026 at 11:34 pm

    OK, I solved the problem after lots of trial-and-error.

    Both the signature and the public key data, when in their pure byte string form, need to be reversed, i.e. first byte to last position, and so on.
    Then the above works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to port a computer game from windows to GNU/Linux. It uses Ogre3D,CEGUI,
Im trying to port this function to c# http://www.phpsnaps.com/snaps/view/clean-url/ I have problems to transform
I'm trying to port a GTK-based Linux app to Mac OS-X. I have the
I'm trying to port a project from Windows to Mac. I'm having troubles compiling
I am trying to port an application from Windows to Linux. In Windows I
I'm trying to port a Swing application to GWT. However lots of this application
I am trying to port this algorithm to clojure. My code is (defn calc-iterations
I am trying to port a native C++ library to C++/CLI, so I can
I'm trying to port a program which uses a hand-rolled interpolator (developed by a
I trying to port a WinForms project to WPF. But I am have some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.