Re: Provider's public key is invalid



On Sep 11, 5:23 am, Paulo Fernandes
<PauloFernan...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"Del Brocco Andrea" wrote:
I'm try to sign a file using smart card.
I'm using visual studio 2008

 public static byte[] SignMsg(Byte[] msg, X509Certificate2
signerCert,
bool detached)
        {
            //  Place message in a ContentInfo object.
            //  This is required to build a SignedCms object.
            ContentInfo contentInfo = new ContentInfo(msg);

            //  Instantiate SignedCms object with the ContentInfo
above.
            //  Has default SubjectIdentifierType
IssuerAndSerialNumber.
            SignedCms signedCms = new SignedCms(contentInfo,
detached);

            //  Formulate a CmsSigner object for the signer.
            CmsSigner cmsSigner = new CmsSigner(signerCert);

            // Include the following line if the top certificate in
the
            // smartcard is not in the trusted list.
            cmsSigner.IncludeOption = X509IncludeOption.EndCertOnly;

            //  Sign the CMS/PKCS #7 message. The second argument is
            //  needed to ask for the pin.
            signedCms.ComputeSignature(cmsSigner, false);

            //  Encode the CMS/PKCS #7 message.
            return signedCms.Encode();
        }

I have installed the certificate in the storage, when i encrypt it
ask
the pin and sign succesfully.

In windows 2003 with the same smart card and different readers i'm be
able succesfully to sign a file and produce a pm7 sucessfully, or
sign
a PDF.

The same code with same card throw "Provider's public key is invalid"
exception in vista, i've tryed 3 different pc with vista and
different
smart card, with 2003 works fine in vista no.

I'm trying to investigate ACL in certificate store but unsuccesfully.

TIA
Andrea Del Brocco

I'm using the exactly same code, evrything works fine exactly 3 times.
Then I get the same error as above: "Provider's public key is invalid"
If I start another process with or without ending the first one, I get 3
more sucessfull signing "sessions".
When I exit the application I get an strage windows Null Referenced Memory
error. Actualiy I get an access violation error exactly prior to "Providers'
public key is invalid" error.

This only happens if I use a smartcard certificate. If I use an installed
certificate I get no error. And if I use the smartcard certificate in word I
can use the certificate to sign the document any times I want to.

I believe that something is not being released but can't figure it out.

Does anybody has the same error? Or better, does anybody know how to get it
working?

Thanks.

The

Hi,

I am facing the same problem. I am using almost the same code and
working in Visual Studio 2005 so targeting .net framework 2.0. My code
works fine on Windows XP with most of the smart cards and also on
Vista but throws this error with a particular smart card from a vendor
named "Bit4id". Could it be a problem on the CSP side implemented by
the vendor or is it an issue with the .net framework?

Any workaround as well?

Regards,
Hashim Saleem
.



Relevant Pages

  • Re: .NET 3.0 Final
    ... Microsoft, ... VS2005 on Windows Vista was. ... If that was the case, then there would be no Visual Studio 2005, because ... How is Borland supposed to handle this when Microsoft itself ...
    (borland.public.delphi.non-technical)
  • Re: .NET 3.0 Final
    ... Microsoft, ... And you don't have to develop ON Vista to target Vista, plus, Visual ... What I was saying was that Visual Studio 2005 running on Windows ... "Microsoft set off a furor among developers this week when it disclosed ...
    (borland.public.delphi.non-technical)
  • Re: side-by_side error on Vista
    ... If it tries to install the files into the SXS directory on Vista, ... in Visual Studio 2005 to find forums and newsgroups. ... You can use VS to create a setup project for your project. ... Dependency Walker told me that the offending DLLs are MSVCR80.DLL ...
    (microsoft.public.win32.programmer.ui)
  • RE: VS2005 macros not working in VISTA-RC2
    ... This was a clean install of VS2005 on top of a clean install of RC2. ... Visual Studio 2005 macros do not work on Windows Vista for many people. ... recommend AVOIDING upgrading to Vista for any production machines. ...
    (microsoft.public.vsnet.general)
  • Re: What framework ???
    ... Framework 3.0, as it is basically the 2.0 Framework plus WPF, WCF, and WWF, ... If you're asking about the development machines, you can run Visual Studio ... Vista programs do not run by default with full permissions. ... sure that when move to window vista the transition will go smooth. ...
    (microsoft.public.dotnet.framework)