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