GalaxyPilot —— D.S


                  生命不熄,戰(zhàn)斗不止
          數(shù)據(jù)加載中……

          注冊(cè)機(jī)

          某開發(fā)平臺(tái)的注冊(cè)機(jī),花了我兩個(gè)星期的時(shí)間才搞定,是什么平臺(tái)自己去猜,我就不說(shuō)了!?
          String args = "";是原來(lái)的加密信息,有公司名稱,只好取掉了。

          import java.io.ByteArrayOutputStream;
          import java.security.KeyFactory;
          import java.security.KeyPair;
          import java.security.KeyPairGenerator;
          import java.security.Security;
          import java.security.spec.PKCS8EncodedKeySpec;
          import java.security.spec.X509EncodedKeySpec;
          import javax.crypto.Cipher;
          import org.bouncycastle.jce.provider.BouncyCastleProvider;

          public class rsaok {
          ?private byte[] PrivateKey;

          ?private byte[] PublicKey;

          ?public static void main(String[] args) {
          ??BouncyCastleProvider bouncycastleprovider = new BouncyCastleProvider();
          ??if (Security.getProperty(bouncycastleprovider.getName()) == null)
          ???Security.addProvider(bouncycastleprovider);
          ??rsaok t = new rsaok();
          ??t.key();
          ??t.encrypt();
          ?}

          ?public void encrypt() {
          ??String args = "";
          ??byte abyte0[] = null;
          ??Cipher cipher;
          ??byte abyte1[];
          ??int i;
          ??ByteArrayOutputStream bytearrayoutputstream;
          ??int k;
          ??try {
          ???PKCS8EncodedKeySpec pkcs8encodedkeyspec = new PKCS8EncodedKeySpec(
          ?????PrivateKey);
          ???KeyFactory keyfactory = KeyFactory.getInstance("RSA");
          ???java.security.PrivateKey privatekey = keyfactory
          ?????.generatePrivate(pkcs8encodedkeyspec);
          ???cipher = Cipher.getInstance("RSA", "BC");
          ???cipher.init(2, privatekey);
          ???abyte1 = args.getBytes();
          ???i = cipher.getBlockSize();
          ???bytearrayoutputstream = new ByteArrayOutputStream();
          ???for (k = 0; k < abyte1.length;) {
          ????int j;
          ????if (abyte1.length - k >= i)
          ?????j = i;
          ????else
          ?????j = abyte1.length - k;
          ????bytearrayoutputstream.write(cipher.doFinal(abyte1, k, j));
          ????k += i;
          ???}
          ???bytearrayoutputstream.flush();
          ???bytearrayoutputstream.close();
          ???abyte0 = bytearrayoutputstream.toByteArray();
          ???System.out.println(byte2hex(abyte0));
          ???decrypt(abyte0);
          ??} catch (Exception e) {
          ???e.printStackTrace();
          ??}
          ?}

          ?public void decrypt(byte[] abyte1) {
          ??try {
          ???String a = "323856EEAD0A7415283B7B58BDCDD6F58A0EB672E9A134C4923D1230D5E2F6B87CD2FAE30E2DB6CB
          50C60E3C7E91DD9D41938D63B28A0D6BE380EBFA748C99E81A4F983343D80C1541728B1259F49FDB4D
          CCAA62563AC3C14A91B6C7C374E7AE6B508D79487442B99390AF7C5A699A7040FB6FA7E9EF51100383
          6C646ED45651";
          ???X509EncodedKeySpec x509encodedkeyspec = new X509EncodedKeySpec(PublicKey);
          ???//X509EncodedKeySpec x509encodedkeyspec = new X509EncodedKeySpec(hex2byte("30819F300D06092A864886F70D010101050003818D0030818902818100BE0C59D90E7A5A582626A209492
          452475130557AAE4400180BCB5B0E4138F8C8DED8185E51D17A5FF8B873084742CC245C6DC636432CBA
          A5401E5312EBA05A4AB79CB71C71A0E0221BB39DA9893026110447F9820B48C88B8A9862ABADB3E5462
          FADD45E3DD251658F48124C6AA091831404E52471A72A4D6CC989EA4959DECB0203010001"));
          ???Cipher cipher;
          ???int i;
          ???ByteArrayOutputStream bytearrayoutputstream;
          ???int k;
          ???KeyFactory keyfactory = KeyFactory.getInstance("RSA");
          ???java.security.PublicKey publickey = keyfactory
          ?????.generatePublic(x509encodedkeyspec);
          ???cipher = Cipher.getInstance("RSA", "BC");
          ???cipher.init(2, publickey);
          ???i = cipher.getBlockSize();
          ???bytearrayoutputstream = new ByteArrayOutputStream();
          ???for (k = 0; k < abyte1.length;) {
          ????int j;
          ????if (abyte1.length - k >= i)
          ?????j = i;
          ????else
          ?????j = abyte1.length - k;
          ????bytearrayoutputstream.write(cipher.doFinal(abyte1, k, j));
          ????k += i;
          ???}
          ???byte abyte0[];
          ???bytearrayoutputstream.flush();
          ???bytearrayoutputstream.close();
          ???abyte0 = bytearrayoutputstream.toByteArray();
          ???System.out.println(new String(abyte0));
          ??} catch (Exception e) {
          ???e.printStackTrace();
          ??}
          ?}

          ?public void key() {
          ??try {
          ???KeyPairGenerator kpg = null;
          ???kpg = KeyPairGenerator.getInstance("RSA", "BC");
          ???kpg.initialize(1024);
          ???KeyPair kp = kpg.generateKeyPair();
          ???PrivateKey = kp.getPrivate().getEncoded();
          ???System.out.println("PrivateKey:"+byte2hex(PrivateKey));
          ???PublicKey = kp.getPublic().getEncoded();
          ???System.out.println("PublicKey:"+byte2hex(PublicKey));
          ??} catch (Exception e) {
          ???e.printStackTrace();
          ??}
          ?}

          ?private String byte2hex(byte[] b) {
          ??String hs = "";
          ??String stmp = "";
          ??for (int n = 0; n < b.length; n++) {
          ???stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
          ???if (stmp.length() == 1)
          ????hs = hs + "0" + stmp;
          ???else
          ????hs = hs + stmp;
          ???if (n < b.length - 1)
          ????hs = hs + ":";
          ??}
          ??return hs.toUpperCase();
          ?}

          ?public byte[] hex2byte(String hex) throws IllegalArgumentException {
          ??if (hex.length() % 2 != 0) {
          ???throw new IllegalArgumentException();
          ??}
          ??char[] arr = hex.toCharArray();
          ??byte[] b = new byte[hex.length() / 2];
          ??for (int i = 0, j = 0, l = hex.length(); i < l; i++, j++) {
          ???String swap = "" + arr[i++] + arr[i];
          ???int byteint = Integer.parseInt(swap, 16) & 0xFF;
          ???b[j] = new Integer(byteint).byteValue();
          ??}
          ??return b;
          ?}
          }

          posted on 2006-04-20 08:42 舵手 閱讀(20819) 評(píng)論(6)  編輯  收藏

          評(píng)論

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          有朋友問是什么軟件的注冊(cè)機(jī),恕我不能告訴大家,這關(guān)系到一個(gè)公司,自己研究還行,萬(wàn)一誰(shuí)公布出去,必然影響該公司。
          2006-04-20 08:46 | 舵手 QQ:8117892

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          您知道borland公司怎樣知道那個(gè)公司在使用他們的盜版的軟件嗎?
          2006-04-20 10:53 | Harryson

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          這個(gè)不知道,沒有研究過(guò)。
          2006-04-20 12:57 | 舵手

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          后面唄
          2006-04-21 12:53 | keith

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          我可沒說(shuō)過(guò)有什么大不了的,放在這里只是為了方便自己,需要時(shí)可以隨時(shí)找到。
          2007-10-19 11:48 | 舵手 QQ:8117892

          # re: 注冊(cè)機(jī)  回復(fù)  更多評(píng)論   

          能幫我破解一個(gè)程序嗎???
          QQ254914874
          2007-11-22 17:18 | xxoo

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 时尚| 金寨县| 霍山县| 视频| 杭锦后旗| 万山特区| 镇坪县| 观塘区| 雷波县| 孝昌县| 建阳市| 黑龙江省| 顺义区| 乃东县| 资溪县| 峨山| 晴隆县| 建瓯市| 玉门市| 政和县| 桂林市| 福州市| 民丰县| 民县| 镇雄县| 汾阳市| 余干县| 石门县| 南部县| 共和县| 盐山县| 武强县| 普兰店市| 仙游县| 微山县| 新乡县| 苍南县| 五原县| 山东| 巫溪县| 鄂托克前旗|