Revision 6586
Added by ben leinfelder about 13 years ago
src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java | ||
---|---|---|
298 | 298 |
String entrySubject = CertificateManager.getInstance().getSubjectDN((X509Certificate) entryCertificate); |
299 | 299 |
logMetacat.debug("Entry certificate subject: " + entrySubject); |
300 | 300 |
if (entrySubject.equals(givenSubject)) { |
301 |
// check the public key matches |
|
302 |
boolean equal = IOUtils.contentEquals( |
|
303 |
new ByteArrayInputStream(entryCertificate.getPublicKey().getEncoded()), |
|
304 |
new ByteArrayInputStream(certificate.getPublicKey().getEncoded())); |
|
305 |
if (equal) { |
|
306 |
return true; |
|
301 |
try { |
|
302 |
certificate.verify(entryCertificate.getPublicKey()); |
|
303 |
} catch (Exception e) { |
|
304 |
logMetacat.warn("Certificate not verifiable: " + e.getMessage(), e); |
|
305 |
continue; |
|
307 | 306 |
} |
307 |
// if we pass verification, we did it! |
|
308 |
return true; |
|
308 | 309 |
} |
309 | 310 |
} |
310 | 311 |
} |
Also available in: Unified diff
verify certificate