微信公众号支付签名算法(详见:http://pay.weixin.qq.com/wiki/doc/api/index.php?chapter=4_3)
@param packageParams 原始参数
@param signKey 加密Key(即 商户Key)
@param charset 编码
@return 签名字符串
324316
public static String createSign(Map<String, String> packageParams, String signKey) {
        SortedMap<String, String> sortedMap = new TreeMap<String, String>();
        sortedMap.putAll(packageParams);

        List<String> keys = new ArrayList<String>(packageParams.keySet());
        Collections.sort(keys);


        StringBuffer toSign = new StringBuffer();
        for (String key : keys) {
            String value = packageParams.get(key);
            if (null != value && !"".equals(value) && !"sign".equals(key)
                    && !"key".equals(key)) {
                toSign.append(key + "=" + value + "&");
            }
        }
        toSign.append("key=" + signKey);
        String sign = DigestUtils.md5Hex(toSign.toString())
                .toUpperCase();
        return sign;
    }
1273177
public String sign(String message) {
		try {
			final byte[] signature = signer.sign(message.getBytes(charsetName));
			return new String(Base64.encodeBase64(signature, false));
		} catch (UnsupportedEncodingException e) {
			throw new SignatureException("unsupported encoding: charsetName=" + charsetName, e);
		}
	}
784649
public static String sendRedPack(Map<String, String> params, String certPath, String partnerKey) {
		return HttpUtils.postSSL(sendRedPackUrl, PaymentKit.toXml(params), certPath, partnerKey);
	}
861621
public static String postPresignV4(String stringToSign, String secretKey, DateTime date, String region)
    throws NoSuchAlgorithmException, InvalidKeyException {
    Signer signer = new Signer(null, null, date, region, null, secretKey, null);
    signer.stringToSign = stringToSign;
    signer.setSigningKey();
    signer.setSignature();

    return signer.signature;
  }
362594
public static <T> String generateSign(RestRequestParam<T> param, String secretkey) {
    TreeMap<String, String> paramsMap = new TreeMap<String, String>();
    paramsMap.put("accesskey", param.getCommon().getAccesskey());
    paramsMap.put("timestamp", Long.toString(param.getCommon().getTimestamp()));

    //    for (Map.Entry<String, String> entry : param.getData())
    //    {
    //        paramsMap.put(entry.getKey(), entry.getValue().toString());
    //    }
    paramsMap.put("secretkey", secretkey);
    return generateSignByRule(paramsMap);
  }
1277172
private String buildRsaPayString(Map<String, String> payParams) {
        String payString = buildSignString(payParams, "\"");
        String sign = RSA.sign(payString, alipay.appPriKey, alipay.inputCharset);
        try {
            sign = URLEncoder.encode(sign, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new AliPayException("sign encode failed", e);
        }
        payString += ("&sign_type=\"" + SignType.RSA.value() + "\"&sign=\""+ sign +"\"");
        return payString;
    }
963505
public static String rsaSign(String content, String privateKey) {

        if (null == content || privateKey == null) {
            return null;
        }

        try {
            PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey, Base64.DEFAULT));
            KeyFactory keyf = KeyFactory.getInstance("RSA");
            PrivateKey priKey = keyf.generatePrivate(priPKCS8);
            java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
            signature.initSign(priKey);
            signature.update(content.getBytes(CHARSET));
            byte[] signed = signature.sign();
            return Base64.encodeToString(signed, Base64.DEFAULT);
        } catch (Exception e) {
            //  这里是安全算法，为避免出现异常时泄露加密信息，这里不打印具体日志
            HMSAgentLog.e("rsaSign error");
        }

        return null;
    }
255372
public static boolean checkParam(Map<String, String> params, String key) {
        boolean result = false;
        if (params.containsKey("sign")) {
            String sign = params.get("sign");
            params.remove("sign");
            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
            SignUtils.buildPayParams(buf, params, false);
            String preStr = buf.toString();
            String signReceive = MD5Utils.sign(preStr, "&key=" + key, "utf-8");
            result = sign.equalsIgnoreCase(signReceive);
        }
        return result;
    }
819631
public SignatureResponse sendSignatureRequest(SignatureRequest request) throws SignitException, IOException {
        if (request == null) {
            return null;
        }
        if (!auth.hasAccessTokenType() || !auth.hasAppId() || !auth.hasSecretKey()) {
            throw new SignitException("请完善开发者信息");
        }
        httpClient.withAuth(auth)
                .withPostObject(request);
        if (!auth.hasAccessToken()) {
            getOauthData(auth.getAppId(), auth.getSecretKey(), auth.getAccessTokenType(), true);
        }
        return retrySendRequest();
    }
401162
private String createSignature(Credentials credentials, String secretKey) {
        return new SignatureGenerator().generate(
                secretKey,
                credentials.getMethod(),
                credentials.getTimestamp(),
                credentials.getPath(),
                credentials.getContent());
    }
10487
private final String computeSigningCacheKeyName(AWSCredentials credentials,
            AWS4SignerRequestParams signerRequestParams) {
        final StringBuilder hashKeyBuilder = new StringBuilder(
                credentials.getAWSSecretKey());

        return hashKeyBuilder.append("-")
                .append(signerRequestParams.getRegionName())
                .append("-")
                .append(signerRequestParams.getServiceName()).toString();
    }
832709
public static boolean verifyNotify(Map<String, String> params, String paternerKey) {
		String sign = params.get("sign");
		String localSign = PaymentKit.createSign(params, paternerKey);
		return sign.equals(localSign);
	}
1013091
public String getLabel(JKLocale locale, final String key, final Object... params) {
		if (key == null || key.trim().equals("")) {
			return "";
		}
		String newKey = JKCollectionUtil.fixPropertyKey(key);
		Properties prop = getLables(locale);
		if (prop.containsValue(newKey)) {
			// to avoid calling the values as keys
			return newKey;
		}
		String value = prop.getProperty(newKey);
//		System.out.println(prop);
		// Fix the string only if not found
		if (value == null || value.equals("")) {
			value = newKey;
			// }
			// if (!value.equals("")) {
			value = fixValue(value);
			// to avoid printing the error statement again
			setProperty(locale, key, value);
		}
		return setParamsters(value, params);
	}
1045043
public static String preOrder(Map<String, String> params, String privateKey) throws Exception {
		// 生成签名前先去除sign
		params.remove("sign");
		params.put("sign", RSAUtils.encryptByPrivateKey(PaymentKit.packageSign(params, false), privateKey));
		Map<String, String> headers = new HashMap<String, String>();
		headers.put("Content-Type", "application/json");
		return HttpKit.post(PERORDER, JSON.toJSONString(params), headers);
	}
960122
private static String buildKey(String key, Map<String, Object> parameters) {
        // 匹配符合  :name 格式的参数
        Matcher matcher = PATTERN.matcher(key);
        if (matcher.find()) {

            StringBuilder builder = new StringBuilder();

            int index = 0;

            do {
                // 提取参数名称
                final String name = matcher.group(1).trim();

                Object value = null;

                // 解析  a.b.c 类型的名称 
                int find = name.indexOf('.');
                if (find >= 0) {

                    // 用  BeanWrapper 获取属性值
                    Object bean = parameters.get(name.substring(0, find));
                    if (bean != null) {
                        value = new BeanWrapperImpl(bean)
                                .getPropertyValue(name.substring(find + 1));
                    }

                } else {

                    // 获取参数值
                    value = parameters.get(name);
                }

                // 拼装参数值
                builder.append(key.substring(index, matcher.start()));
                builder.append(value);

                index = matcher.end();

            } while (matcher.find());

            // 拼装最后一段
            builder.append(key.substring(index));

            return builder.toString();
        }

        return key;
    }
937559
@SdkProtectedApi
    public static Signer createSigner(String signerType, SignerParams params) {
        Signer signer = createSigner(signerType);

        if (signer instanceof ServiceAwareSigner) {
            ((ServiceAwareSigner) signer).setServiceName(params.getServiceName());
        }

        if (signer instanceof RegionAwareSigner) {
            ((RegionAwareSigner) signer).setRegionName(params.getRegionName());
        }

        return signer;
    }
1280086
public static String sign(String text, String key, String input_charset) {
        text = text + key;
        return DigestUtils.md5Hex(getContentBytes(text, input_charset));
    }