use of org.xwiki.crypto.store.wiki.internal.query.X509CertificateReferenceKeyIdentifierQuery in project xwiki-platform by xwiki.
the class AbstractX509WikiStore method findCertificate.
/**
* Find the reference of the XObject storing a matching certificate in the given store.
*
* @param store the reference to a document or space used to store certificates.
* @param publicKey the certificate to find the storage for.
* @return a reference to the XObject storing a matching certificate, or null if none were found.
* @throws CertificateStoreException on error.
*/
protected CertificateObjectReference findCertificate(StoreReference store, X509CertifiedPublicKey publicKey) throws CertificateStoreException {
byte[] keyId = publicKey.getSubjectKeyIdentifier();
CertificateObjectReference certRef;
if (keyId != null) {
certRef = new X509CertificateReferenceKeyIdentifierQuery(resolveStore(store), this.base64, this.queryManager, this.entityReferenceSerializer).getReference(keyId);
} else {
certRef = new X509CertificateReferenceIssuerAndSerialQuery(resolveStore(store), this.base64, this.queryManager, this.entityReferenceSerializer).getReference(publicKey.getIssuer(), publicKey.getSerialNumber());
}
return certRef;
}
Aggregations