code: public static String getDigAlgFromSigAlg(String signatureAlgorithm) {
          signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
          int with = signatureAlgorithm.indexOf("WITH");
          if (with > 0) {
              return signatureAlgorithm.substring(0, with);
          }
          return null;
      }
docs: Extracts the digest algorithm name from a signature
  algorithm name.