Search in sources :

Example 1 with XKMSCertificateException

use of org.apache.cxf.xkms.exception.XKMSCertificateException in project cxf by apache.

the class X509Locator method locate.

@Override
public UnverifiedKeyBindingType locate(LocateRequestType request) {
    List<UseKeyWithType> keyIDs = parse(request);
    X509Certificate cert;
    try {
        cert = findCertificate(keyIDs);
        if (cert == null) {
            return null;
        }
        UnverifiedKeyBindingType result = new UnverifiedKeyBindingType();
        result.setKeyInfo(X509Utils.getKeyInfo(cert));
        return result;
    } catch (CertificateEncodingException e) {
        throw new XKMSCertificateException("Cannot encode certificate: " + e.getMessage(), e);
    } catch (CertificateException e1) {
        throw new XKMSCertificateException(e1.getMessage(), e1);
    }
}
Also used : XKMSCertificateException(org.apache.cxf.xkms.exception.XKMSCertificateException) UseKeyWithType(org.apache.cxf.xkms.model.xkms.UseKeyWithType) CertificateEncodingException(java.security.cert.CertificateEncodingException) XKMSCertificateException(org.apache.cxf.xkms.exception.XKMSCertificateException) CertificateException(java.security.cert.CertificateException) X509Certificate(java.security.cert.X509Certificate) UnverifiedKeyBindingType(org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType)

Aggregations

CertificateEncodingException (java.security.cert.CertificateEncodingException)1 CertificateException (java.security.cert.CertificateException)1 X509Certificate (java.security.cert.X509Certificate)1 XKMSCertificateException (org.apache.cxf.xkms.exception.XKMSCertificateException)1 UnverifiedKeyBindingType (org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType)1 UseKeyWithType (org.apache.cxf.xkms.model.xkms.UseKeyWithType)1