Re: ASN1 bad tag value met on EnvelopedData.Decrypt str

From: Daniel Sie [MSFT] (dsie_at_online.microsoft.com)
Date: 09/24/04


Date: Thu, 23 Sep 2004 21:14:01 -0700

Can you dump out Message just before Decrypt to see what the value is?

-- 
Thanks,
Daniel Sie [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kristine" <wingsforwheels@hotmail.com> wrote in message 
news:37603010.0409230741.901fa32@posting.google.com...
> Users are being linked to our site, and the URL passed to us contains
> encrypted data (encrypted by JAVA).  The site that is passing the URL
> to us and encrypting the parameter has my public key/certificate.
> When I try to decrypt using CAPICOM the "ASN1 bad tag value met" error
> is raised.  I checked the decoded text on the ANS1 dump tool and it
> did not raise any errors.  I've included my code below, if anyone sees
> anything wrong with it please let me know (this is the first time I've
> implemented the asynchronous/key pair).
>
> Would this error be raised if my private key was not found?  Is there
> anyway to check that it was found?  I did verify that the private key
> is associated with the certificate.
>
> Set Store = Server.CreateObject("CAPICOM.Store")
> Store.Open CAPICOM_LOCAL_MACHINE_STORE, "MY" ,0
> Set Certificates = 
> Store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME,
> SubjectName)
>
> Response.Write("<br>Certificate found: " & Store.Certificates.Count)
>
> If Store.Certificates.Count > 0 then
> Set EnvelopedData = Server.CreateObject("CAPICOM.EnvelopedData")
> EnvelopedData.Recipients.Add Store.Certificates(1)
> Message = Request.QueryString("query")
> Response.write "<p>Encrypt= " & Message
> 'EnvelopedData.Decrypt Message          <---ERROR HERE
> 'str_out = EnvelopedData.Content
> 'response.write "<p>Decrypt= " & str_out
> Else
> response.write "<P>Could not find certificate."
> End If 


Relevant Pages

  • Re: EFS cant decrypt
    ... you will be able to decrypt your ... If you didn't find that certificate and couldn't export the private key see ... Was your password reset sometime between encrypting the files and now? ...
    (microsoft.public.security)
  • Re: EFS cant decrypt
    ... you will be able to decrypt your ... If you didn't find that certificate and couldn't export the private key see ... Was your password reset sometime between encrypting the files and now? ...
    (microsoft.public.windowsxp.security_admin)
  • Re: EFS cant decrypt
    ... you will be able to decrypt your ... If you didn't find that certificate and couldn't export the private key see ... Was your password reset sometime between encrypting the files and now? ...
    (microsoft.public.windows.server.security)
  • Re: DRA is Decrypting Files when it shouldnt be!!!
    ... > EFS is allowing the RA to decrypt 200 files that were encrypted BEFORE an RA ... > encryption to get the RA to decrypt encrypted files. ... the default RA certificate was used. ... certificate and private key only when needed). ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Problem with EFS in W2K....help!
    ... are being followed to import the certificate AND the EFS private key for the recovery ... Just importing the certificate in a .cer file ... > decrypt the files.... ...
    (microsoft.public.win2000.security)