24.12.2014 Views

Download - Svetlin Nakov

Download - Svetlin Nakov

Download - Svetlin Nakov

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

* consist of. The certification chain should be PkiPath-encoded (ASN.1 DER<br />

* formatted), stored as Base64-string. The extracted chain is stored in the<br />

* member variables mCertPath as a CertPath object and in mCertChain as array<br />

* of X.509 certificates. Also the certificate used for signing the received<br />

* file is extracted in the member variable mCertificate.<br />

* @throws Exception if the received certification chain can not be decoded<br />

* (i.e. its encoding or internal format is invalid).<br />

*/<br />

private void processReceivedCertificationChain()<br />

throws Exception {<br />

String certChainBase64Encoded = mActionForm.getCertChain();<br />

try {<br />

mCertPath = DigitalSignatureUtils.loadCertPathFromBase64String(<br />

certChainBase64Encoded);<br />

List certsInChain = mCertPath.getCertificates();<br />

mCertChain = (X509Certificate[])<br />

certsInChain.toArray(new X509Certificate[0]);<br />

mCertificate = mCertChain[0];<br />

}<br />

catch (Exception e) {<br />

throw new Exception("Invalid certification chain received.", e);<br />

}<br />

}<br />

/**<br />

* Displays given certification chain. Displays the length of the chain and the<br />

* subject distinguished names of all certificates in the chain, starting from<br />

* the first and finishing to the last.<br />

*/<br />

private void displayCertificationChain(X509Certificate[] aCertChain)<br />

throws IOException {<br />

mOut.println("Certification chain length: " + aCertChain.length + " ");<br />

for (int i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!