程序包 com.sh.util.rsa

类 RSAUtil


public final class RSAUtil extends RSABaseCoder

Description: RSA安全编码组件

Title:首亨软件 - TSS/CRM等

从以下版本开始:
Jan 17, 2013
  • 构造器详细资料

    • RSAUtil

      public RSAUtil()
  • 方法详细资料

    • sign

      public static String sign(String dataStr, String privateKey) throws Exception
      用私钥对信息生成数字签名
      参数:
      dataStr - 加密数据
      privateKey - 私钥
      返回:
      String
      抛出:
      Exception - Exception
    • verify

      public static boolean verify(String dataStr, String publicKey, String sign) throws Exception
      校验数字签名
      参数:
      dataStr - 加密数据
      publicKey - 公钥
      sign - 数字签名
      返回:
      校验成功返回true 失败返回false
      抛出:
      Exception - Exception
    • decryptByPrivateKey

      public static String decryptByPrivateKey(String dataStr, String key) throws Exception
      用私钥解密 http://www.5a520.cn http://www.feng123.com
      参数:
      dataStr - String
      key - String
      返回:
      String
      抛出:
      Exception - Exception
    • decryptByPublicKey

      public static String decryptByPublicKey(String dataStr, String key) throws Exception
      用公钥解密
      参数:
      dataStr - 待解密数据
      key - 公钥
      返回:
      String
      抛出:
      Exception - Exception
    • encryptByPublicKey

      public static String encryptByPublicKey(String dataStr, String key) throws Exception
      用公钥加密
      参数:
      dataStr - String
      key - String
      返回:
      String
      抛出:
      Exception - Exception
    • encryptByPrivateKey

      public static String encryptByPrivateKey(String dataStr, String key) throws Exception
      用私钥加密
      参数:
      dataStr - String
      key - String
      返回:
      String
      抛出:
      Exception - Exception
    • getPrivateKey

      public static String getPrivateKey(Map<String,Key> keyMap) throws Exception
      取得私钥
      参数:
      keyMap - Map
      返回:
      String
      抛出:
      Exception - Exception
    • getPublicKey

      public static String getPublicKey(Map<String,Key> keyMap) throws Exception
      取得公钥
      参数:
      keyMap - Map
      返回:
      String
      抛出:
      Exception - Exception
    • initKey

      public static Map<String,Key> initKey() throws Exception
      初始化密钥
      返回:
      Map
      抛出:
      Exception - Exception
    • parserStr

      public static String parserStr(String str)
      解析换行符
      参数:
      str - String
      返回:
      String
    • transferStr

      public static String transferStr(String str)
      处理换行符
      参数:
      str - String
      返回:
      String
    • main

      public static void main(String[] args) throws Exception
      抛出:
      Exception