2 delilahy delilahy 于 2014.03.17 17:03 提问

这是一段解密程序,如何做相应的加密程序?请不吝赐教
  byte[] code = StringUtil.hexDecode(FileUtil.readText("f:/src cense1.dat").replaceAll("\\s+", "").trim());
  JDKX509CertificateFactory certificatefactory = new JDKX509CertificateFactory();
  X509Certificate cer = (X509Certificate)certificatefactory.engineGenerateCertificate(new ByteArrayInputStream(StringUtil.base64Decode(cert)));
  PublicKey pubKey = cer.getPublicKey();
  ZRSACipher dc = new ZRSACipher();
  dc.init(2, pubKey);
  byte[] bs = new byte[code.length*2];
  int indexBS = 0;
  int indexCode = 0;
  while (code.length - indexCode > 128) {
    indexBS += dc.doFinal(code, indexCode, 128, bs, indexBS);
    indexCode += 128;
  }
  indexBS += dc.doFinal(code, indexCode, code.length - indexCode, bs, indexBS);
Csdn user default icon
上传中...
上传图片
插入图片