Page 1 of 1

Use public Key to decrypt a signature

Posted: Thu 27 Aug 2015 01:39
by vanmeir
Hello,
...sorry to bother you again but I'm really stuck now.

I have a certificate with a Public Key in it which comes from a SmartCard.
I can import it into a TScCertificate component and it works well on several operations that I have to perform. I can also 'see' the RSA parameters that are enclosed.

Now the regulations say that I need to use the Public Key to decrypt a Signature which I also get from the chip. Later on I have to compare the decrypted result with another value to be sure the chip and its certificate is authentic.

How can I do that?

When I use the TScKey.Decrypt method on the encrypted signature data I get the message that it can not be decrypted without a Public Key. The same message appears when I try Decryp with the TScCertificate component.

Can someone please help me?

Re: Use public Key to decrypt a signature

Posted: Fri 28 Aug 2015 15:06
by Dimon
Use the TScCertificate.VerifySign function to verify whether the signature is correct (it is named decrypting the signature) for specified data.
You can learn more about this here: https://en.wikipedia.org/wiki/Public-key_cryptography

Re: Use public Key to decrypt a signature

Posted: Fri 28 Aug 2015 15:44
by vanmeir
Hi Dimon,

I know you're perfectly right but...

I'm building an app in which I'm supposed to follow up the instructions of Dutch organisation for Vehicle Registration and they say that I have to decrypt the signature which will give me some kind of parameter.
Later on in the process I need this parameter so it's all not just for verification of the signature but also for retrieving some useful data out of the signature.

I just upgraded from SB prof to SB prof with source. Now I'm investigating if it's possible to make a helper class with which I can bypass the check of the used Key being private. Hope this brings me there.
If you have a better suggestion...

Regards,
Frans

Re: Use public Key to decrypt a signature

Posted: Fri 28 Aug 2015 16:22
by Dimon
In asymmetric encryption, (RSA or DSA types) two keys are used. The private key is used for data decryption and signing, the public key is used for data encrypting.
The message cannot be decrypted by anyone who does not possess the matching private key. This is used in an attempt to ensure confidentiality.