code: public static String getEncAlgFromSigAlg(String signatureAlgorithm) {
          signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
          int with = signatureAlgorithm.indexOf("WITH");
          String keyAlgorithm = null;
          if (with > 0) {
              int and = signatureAlgorithm.indexOf("AND", with + 4);
              if (and > 0) {
                  keyAlgorithm = signatureAlgorithm.substring(with + 4, and);
              } else {
                  keyAlgorithm = signatureAlgorithm.substring(with + 4);
              }
              if (keyAlgorithm.equalsIgnoreCase("ECDSA")) {
                  keyAlgorithm = "EC";
              }
          }
          return keyAlgorithm;
      }
docs: Extracts the encryption algorithm name from a signature
  algorithm name.