RE: Decryption using private key from cert store failing with err

From: scott (sjumsdn_at_newsgroup.nospam)
Date: 02/14/05


Date: Mon, 14 Feb 2005 09:41:15 -0800

I had already looked up the error in MSDN and none of the reasons seemed
applicable to my situation. I have previously tried using encrypt, and it
also fails with the bad data error. The content of the buffer being
encrypted/decrypted should have no bearing on whether the call works (except
if padding is involved, which it is not in my case).

I need to encrypt/decrypt with a certs public/private key. The encrypting a
file sample in msdn just uses a password.

"Rhett Gong [MSFT]" wrote:

> You get error 80090005 NTE_BAD_DATA. in MSDN:
> "The data to be decrypted is invalid. For example, when a block cipher is
> used and the Final flag is FALSE, the value specified by pdwDataLen must be
> a multiple of the block size. This error can also be returned when the
> padding is found to be invalid. "
>
> I saw you were using a buffer set with 'A', I am not sure what you are
> trying to do there. If you want to make a simple test, you may encrypt this
> data first and decrypt it later with the same key. For how to encrypt data,
> please reference "Example C Program: Encrypting a File" in MSDN.
>
>
> Thanks,
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
>
>



Relevant Pages

  • Re: Web.config Security
    ... You can encrypt portions of your web.config using the aspnet_setreg utility ... (search for it on msdn). ... you need to set up strong ACLs on this ... Microsoft MVP - Windows Client ...
    (microsoft.public.security)
  • Re: usb token
    ... from the diagram (from the same msdn page), ... is randomly generated and used to encrypt the message. ... It's a clearer picture to me now that i realised that the session key ... private key stored in the token is used for encrypting the seesion ...
    (comp.security.misc)
  • Re: Password
    ... you want to encrypt it. ... systems you could use DPAPI (see MSDN), for older OS's you'll need to ... roll your own using some encryption library. ...
    (microsoft.public.vc.mfc)
  • RE: Decryption using private key from cert store failing with err 8009
    ... "The data to be decrypted is invalid. ... when a block cipher is ... data first and decrypt it later with the same key. ... Encrypting a File" in MSDN. ...
    (microsoft.public.platformsdk.security)
  • Re: algorithm info
    ... > I already took into account stream cyphers, and probably i will choose one of those. ... > I have to encrypt files in block of 1 byte, and with the possibility to decrypt a byte ... position of the byte you want to decrypt - not good. ... encrypt the encrypted previous block with a block cipher, ...
    (sci.crypt)

Quantcast