I am using the code below
string alias = null;
PKCS12Store pk12;
// First we'll read the certificate file
pk12 = new PKCS12Store(new FileStream(this.Path, FileMode.Open,
FileAccess.Read), this._password.ToCharArray());
// Then Iterate throught certificate entries to find the private
key entry
IEnumerator i = pk12.aliases();
while (i.MoveNext())
{
alias = ((string)i.Current);
if (pk12.isKeyEntry(alias))
break;
}
_asymmetricKeyParameter = pk12.getKey(alias).getKey();
X509CertificateEntry[] ce = pk12.getCertificateChain(alias);
_chain = new org.bouncycastle.x509.X509Certificate[ce.Length];
*-----this is the point where I am getting the error saying object reference
set to null(ce of previous line of code)*
for (int k = 0; k < ce.Length; ++k)
_chain[k] = ce[k].getCertificate();
I am using Thawte chained certificate. When I debug the code, the Arralists
of PKCS12store(Certs and chainCerts count>0 but keyCerts count is 0.
KeyEntry is loaded and assymmetricKeyParameter is also loaded.
pk12.isKeyEntry(alias) is true.
Is there a process to be followed differently for chained certificates other
than self-signed certificate ?
as this code is working for self-signed certificate but not for chained
ones.
Please let me know the steps if there is difference.
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/GetCertificateChain-alias-is-null-tp4659428p4659442.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php