Thanks Paulo for your quick response. At the end the code leaves as follow,
Public Function GetChain(ByVal cer As Certificate) As
System.Security.Cryptography.X509Certificates.X509Certificate()
Dim context As ICertContext = CType(cer, ICertContext)
Dim ptr As IntPtr = New IntPtr(context.CertContext)
Dim xCert As
System.Security.Cryptography.X509Certificates.X509Certificate = New
System.Security.Cryptography.X509Certificates.X509Certificate(ptr)
Dim cp As Org.BouncyCastle.X509.X509CertificateParser = New
Org.BouncyCastle.X509.X509CertificateParser
Dim chain() As
System.Security.Cryptography.X509Certificates.X509Certificate = New
System.Security.Cryptography.X509Certificates.X509Certificate()
{cp.ReadCertificates(xCert.GetRawCertData)}
'.ReadCertificate(xCert.GetRawCertData())
Return chain
End Function
This is ok. But in the main function the IDE says me that chains must be
from Org.BouncyCastle.X509.X509Certificate in the lines,
sap.SetCrypto(Nothing, chain, Nothing, Nothing),
dic.Name = PdfPKCS7.GetSubjectFields(chain(0)).GetField("CN").
What is going wrong?
Thanks again,
Jose Alvarez de Lara
--------------------------------------------------
From: "Paulo Soares" <[email protected]>
Sent: Tuesday, July 07, 2009 12:31 AM
To: "Post all your questions about iText here"
<[email protected]>
Subject: Re: [iText-questions] How to sign with a smartcard using
anexternalsignature dictionary with iTextSharp, CAPICOM and .NET 1.1
> (1) It's a System.Security.Cryptography.X509Certificates.X509Certificate.
> (2) See (1).
>
> Paulo
>
> ----- Original Message -----
> From: <[email protected]>
> To: "iTextSharp" <[email protected]>
> Sent: Monday, July 06, 2009 11:15 PM
> Subject: [iText-questions] How to sign with a smartcard using an
> externalsignature dictionary with iTextSharp, CAPICOM and .NET 1.1
>
>
> Hi all,
>
> In 'How to sign a PDF using iText and iTextSharp', I am referring to the
> email subject paragraph
> and I am having problems with the function,
>
> Public Function GetChain(ByVal cer As Certificate) As
> Org.BouncyCastle.X509.X509Certificate()
> Dim context As ICertContext = CType(cer, ICertContext)
> Dim ptr As IntPtr = New IntPtr(context.CertContext)
> (1) Dim xCert As X509Certificate = New X509Certificate(ptr)
> Dim cp As Org.BouncyCastle.X509.X509CertificateParser = New
> Org.BouncyCastle.X509.X509CertificateParser
> (2) Dim chain() As Org.BouncyCastle.X509.X509Certificate = New
> Org.BouncyCastle.X509.X509Certificate()
> {cp.ReadCertificate(xCert.GetRawCertData())} 'GetRawCertData()
> Return chain
> End Function
>
> (1) I cannot create an instance of X509Certificate with ptr as argument
> because the only argument you can pass to the class is
> type of Org.BouncyCastle.Asn1.X509.X509CertificateStructure.
>
> (2) I cannot create the chain() array because xCert does not accept
> GetRawCertData()
>
> Does anybody know how is it?
>
> Thanks in advance,
> Jose Alvarez de Lara
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/