protected void checkAlgorithms(JweHeaders headers) {
   KeyAlgorithm providedAlgo = headers.getKeyEncryptionAlgorithm();
   if (providedAlgo != null && !providedAlgo.equals(algorithm)) {
     LOG.warning("Invalid key encryption algorithm: " + providedAlgo);
     throw new JweException(JweException.Error.INVALID_KEY_ALGORITHM);
   }
   if (providedAlgo != null) {
     checkAlgorithm(providedAlgo.getJwaName());
   } else {
     checkAlgorithm(algorithm.getJwaName());
     headers.setKeyEncryptionAlgorithm(algorithm);
   }
 }
 protected String getKeyEncryptionAlgoJava(JweHeaders headers) {
   return AlgorithmUtils.toJavaName(headers.getKeyEncryptionAlgorithm().getJwaName());
 }