Java Code Examples for org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm#getJwaName()

The following examples show how to use org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm#getJwaName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PublicKeyJwsSignatureVerifier.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected String checkAlgorithm(SignatureAlgorithm sigAlgo) {
    String algo = sigAlgo.getJwaName();
    if (algo == null) {
        LOG.warning("Signature algorithm is not set");
        throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
    }
    if (!isValidAlgorithmFamily(algo)
        || !algo.equals(supportedAlgo.getJwaName())) {
        LOG.warning("Invalid signature algorithm: " + algo);
        throw new JwsException(JwsException.Error.INVALID_ALGORITHM);
    }
    return algo;
}
 
Example 2
Source File: HmacJwsSignatureVerifier.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected String checkAlgorithm(SignatureAlgorithm sigAlgo) {

        if (sigAlgo == null) {
            LOG.warning("Signature algorithm is not set");
            throw new JwsException(JwsException.Error.ALGORITHM_NOT_SET);
        }
        String algo = sigAlgo.getJwaName();
        if (!AlgorithmUtils.isHmacSign(algo)
            || !algo.equals(supportedAlgo.getJwaName())) {
            LOG.warning("Invalid signature algorithm: " + algo);
            throw new JwsException(JwsException.Error.INVALID_ALGORITHM);
        }
        return algo;
    }
 
Example 3
Source File: JwsHeaders.java    From cxf with Apache License 2.0 4 votes vote down vote up
public final void setSignatureAlgorithm(SignatureAlgorithm algo) {
    super.setAlgorithm(algo.getJwaName());
}