第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
  • PBE算法要比之前那兩種復雜一些

    查看全部
  • AES的加密方式

    查看全部

    dsf

    查看全部
  • add
    查看全部
  • PBE算法流程
    查看全部
  • Ps1:鹽:指的是“干擾”黑客的字符,比如一些隨機的字符串、數(shù)字等。

    Ps2:new PBEParameterSpec(鹽,迭代次數(shù));。

    public static void jdkPBE() {

    ?? ??? ?try {
    ?? ??? ???? //初始化鹽
    ?? ??? ??? ?SecureRandom random = new SecureRandom();
    ?? ??? ??? ?byte[] salt = random.generateSeed(8);
    ?? ??? ??? ?// 加 密 口令與密鑰
    ?? ??? ??? ?String password = "imooc";
    ?? ??? ??? ?PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray());
    ?? ??? ??? ?SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEWITHMD5andDES");
    ??????????? Key key = factory.generateSecret(pbeKeySpec);
    ?????????? ?
    ?? ??? ??? ?//加密
    ??????????? PBEParameterSpec pbeParameterSpec = new PBEParameterSpec(salt,100);
    ??????????? Cipher cipher = Cipher.getInstance("PBEWITHMD5andDES");
    ?? ??? ???? cipher.init(Cipher.ENCRYPT_MODE, key, pbeParameterSpec);
    ?? ??? ???? byte[] result = cipher.doFinal(src.getBytes());
    ?? ??? ???? System.out.println("jdk PBE encrypt: " + Base64.encodeBase64String(result));
    ?? ??? ??? ?
    ?? ??? ???? //解密
    ?? ??? ???? //初始化
    ?? ??? ???? cipher.init(Cipher.DECRYPT_MODE, key,pbeParameterSpec);
    ?? ??? ???? result = cipher.doFinal(result);
    ?? ??? ???? System.out.println("jdk PBE decrypt: " + new String(result));
    ?? ??? ?} catch (Exception e) {
    ?? ??? ??? ?e.printStackTrace();
    ?? ??? ?}
    ?? ?}
    查看全部
  • 加密算法安全等級:PBE&gt;AES&gt;3DES&gt;DES <br/>
    查看全部
  • Java實現(xiàn)對稱加密——對稱加密算法--PBE

    Ps:PBE算法結合了消息摘要算法和對稱加密算法的優(yōu)點。PBE是基于口令的加密
    對稱加密算法之PBE的特點概述,本質上是對DES/3DES/AES對稱加密算法的包裝,不是新的算法,不過也是最為牛逼的一種方式。
    鹽:指加密的隨機字符串或者口令等,也可以人為是一些擾碼,防止密碼的暴力破解

    查看全部
  • 對稱加密算法——PBE

    查看全部
  • 對稱加密算法-AES 步驟:<br/>
    查看全部
  • JDK實現(xiàn)AES加密解密算法:<br/>public static void jdkAES(){<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;try {<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//生成key<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;KeyGenerator keyGenerator = KeyGenerator.getInstance(&quot;AES&quot;);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//設置密鑰長度<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;keyGenerator.init(128);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//生成密鑰對象<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SecretKey secretKey = keyGenerator.generateKey();<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//獲取密鑰<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;byte[] keyBytes = secretKey.getEncoded();<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//key轉換<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Key key = new SecretKeySpec(keyBytes,&quot;AES&quot;);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//加密<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Cipher cipher = Cipher.getInstance(&quot;AES/ECB/PKCS5Padding&quot;);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//初始化,設置為加密<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;cipher.init(Cipher.ENCRYPT_MODE, key);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;byte[] result = cipher.doFinal(src.getBytes());<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(&quot;jdk aes encrypt: &quot; + Base64.encodeBase64String(result));<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//初始化,設置為解密 <br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;cipher.init(Cipher.DECRYPT_MODE, key);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;result = cipher.doFinal(result);<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(&quot;jdk aes desrypt:&quot; + new String(result));<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;} catch (Exception e) {<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;e.printStackTrace();<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br/>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br/>&nbsp;&nbsp; &nbsp;}
    查看全部
  • AES是DES的高級替代

    1、AES是目前使用最多的對稱加密算法

    2、通常用于移動通信系統(tǒng)加密一級基于SSH協(xié)議的軟件

    3、SSH Client、secureCRT

    4、DES算法的替代者


    查看全部
  • AES是DES的高級替代

    DES有漏洞,所以,產(chǎn)生了3重DES<br>
    3重DES的效率比較低,所以產(chǎn)生了AES<br>
    AES的特點是:
    1:使用的更為廣泛
    2:目前還沒有被破解
    3:通常用與移動通信系統(tǒng)加密和SSH協(xié)議的軟件加密

    查看全部
  • JDK實現(xiàn)3DES<br/><br/>與實現(xiàn)DES方式基本一致,算法名稱要改為DESede,密鑰長度為168,轉換密鑰時使用DESedeKeySpec類.<br/><br/>初始化密鑰:<br/><br/>public static byte[] initSecretKey(){<br/><br/>KeyGenerator kg = KeyGenerator.getInstance(&quot;DESede&quot;); <br/><br/>kg.init(168);<br/><br/>SecretKey secretKey = kg.generateKey();<br/><br/>return secretKey.getEncoded();<br/><br/>}<br/><br/>轉化密鑰:<br/><br/>private static Key toKey(byte[] key){<br/><br/>DESedeKeySpec dks = new DESedeKeySpec(key);<br/><br/>SecretKeyFactory skf = SecretKeyFactory.getInstance(&quot;DESede&quot;);<br/><br/>SecretKey secretKey = skf.generateSecret(dks);<br/><br/>return secretKey;<br/><br/>}<br/><br/>加密:<br/><br/>String cipherAlgorithm=&quot;DESede/ECB/PKCS5Padding&quot;;<br/><br/>public static byte[] encrypt(byte[] data,Key key,String cipherAlgorithm) {<br/><br/>Cipher cipher = Cipher.getInstance(cipherAlgorithm);<br/><br/>cipher.init(Cipher.ENCRYPT_MODE, key);<br/><br/>return cipher.doFinal(data);<br/><br/>}<br/><br/>解密:<br/><br/>public static byte[] decrypt(byte[] data,Key key,String cipherAlgorithm){<br/><br/>Cipher cipher = Cipher.getInstance(cipherAlgorithm);&nbsp; &nbsp;<br/>&nbsp; &nbsp;<br/>cipher.init(Cipher.DECRYPT_MODE, key);<br/>&nbsp; <br/>return cipher.doFinal(data);<br/><br/>}
    查看全部
  • 3、對稱加密算法-3DES
    查看全部
  • 2、3重DES的好處
    查看全部
  • 1、3重DES

    查看全部
  • 對稱加密算法-DES
    查看全部
  • DES加密:BC實現(xiàn)DES算法
    // 生成key
    ?? ??? ??? ?KeyGenerator keyGenerator = KeyGenerator.getInstance("DES");

    ? ? ? ? ?? keyGenerator.getProvider();

    ???????? ? keyGenerator.init(56);

    ?? ??? ???? SecretKey secretKey = keyGenerator.generateKey();
    ?? ??? ??? ?byte[] bytesKey =? secretKey.getEncoded();

    ?? ??? ??? ?// key轉換
    ?? ??? ??? ?DESKeySpec desKeySpec = new DESKeySpec(bytesKey);
    ?? ??? ??? ?SecretKeyFactory factory = SecretKeyFactory.getInstance("DES");
    ?? ??? ??? ?Key convertSecretKey = factory.generateSecret(desKeySpec);

    ?? ??? ??? ?// 加密
    ?? ??? ??? ?Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
    ?? ??? ??? ?cipher.init(Cipher.ENCRYPT_MODE, convertSecretKey);
    ?? ??? ??? ?byte[] result = cipher.doFinal(string.getBytes());
    ?? ??? ??? ?// System.out.println("jdk des encrypt:" + Arrays.toString(result));
    ?? ??? ??? ?System.out.println("bc des encrypt:" + Hex.encodeHexString(result));

    查看全部
  • DES加密:JDK實現(xiàn)DES算法
    // 生成key
    ?? ??? ??? ?KeyGenerator keyGenerator = KeyGenerator.getInstance("DES");
    ?? ??? ??? ?SecretKey secretKey = keyGenerator.generateKey();
    ?? ??? ??? ?byte[] bs = secretKey.getEncoded();

    ?? ??? ??? ?// key轉換
    ?? ??? ??? ?DESKeySpec desKeySpec = new DESKeySpec(bs);
    ?? ??? ??? ?SecretKeyFactory factory = SecretKeyFactory.getInstance("DES");
    ?? ??? ??? ?Key convertSecretKey = factory.generateSecret(desKeySpec);

    ?? ??? ??? ?// 加密
    ?? ??? ??? ?Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
    ?? ??? ??? ?cipher.init(Cipher.ENCRYPT_MODE, convertSecretKey);
    ?? ??? ??? ?byte[] result = cipher.doFinal(string.getBytes());
    ?? ??? ??? ?// System.out.println("jdk des encrypt:" + Arrays.toString(result));
    ?? ??? ??? ?System.out.println("jdk des encrypt:" + Hex.encodeHexString(result));

    查看全部
  • JDK實現(xiàn)DES算法<br/><br/>1.初始化密鑰<br/>使用KeyGenerator類的getInstance()靜態(tài)方法,獲取生成指定算法的密鑰生成器,參數(shù)是算法名稱.<br/>使用KeyGenerator類的init()方法進行密鑰生成器的初始化,指定密鑰生成器產(chǎn)生密鑰的長度.<br/>使用KeyGenerator類的generatorKey()方法生成一個密鑰對象,返回SecretKey密鑰對象.<br/>SecretKey為密鑰對象.使用它的getEncoded()方法返回一個密鑰(字節(jié)數(shù)組形式)<br/><br/>public static byte[] initSecretKey(){<br/>//返回生成指定算法密鑰的KeyGenerator對象<br/>KeyGenerator kg = KeyGenerator.getInstance(&quot;DES&quot;); <br/>//初始化此密鑰生成器,使其具有確定的密鑰大小<br/>kg.init(56);<br/>//生成一個密鑰<br/>SecretKey&nbsp; secretKey = kg.generateKey();<br/>return secretKey.getEncoded();<br/>}<br/><br/>2.轉化密鑰(還原密鑰),將jdk生成的密鑰對象轉化成DES規(guī)則的密鑰對象.<br/>創(chuàng)建一個DESKeySpec實例,作用是將JDK初始化的密鑰轉化成DES規(guī)則的密鑰.<br/>構造方法參數(shù)是JDK生成的密鑰(字節(jié)數(shù)組形式).<br/>使用SecretKeyFactory類的getInstance()靜態(tài)方法獲取一個密鑰工廠實例,參數(shù)是算法名稱<br/>使用SecretKeyFactory類的generateSecret()方法生成密鑰,參數(shù)是DESKeySpec實例.返回SecretKey,返回的SecretKey實例就是符合DES算法的密鑰.<br/><br/>&nbsp;private static Key toKey(byte[] key){<br/>&nbsp;//實例化DES密鑰規(guī)則<br/>&nbsp;DESKeySpec dks = new DESKeySpec(key);<br/>&nbsp;//實例化密鑰工廠<br/>&nbsp;SecretKeyFactory skf = SecretKeyFactory.getInstance(&quot;DES&quot;);<br/>&nbsp;//生成密鑰<br/>&nbsp;SecretKey&nbsp; secretKey = skf.generateSecret(dks);<br/>&nbsp;return secretKey;<br/>&nbsp;}
    查看全部
  • JDK 對稱加密 DES
    查看全部
  • 常用對稱加密算法:

    DES

    AES

    PBE

    IDEA

    查看全部
  • 對稱加密的特點:

    加密秘鑰=解密秘鑰


    查看全部
首頁上一頁1234567下一頁尾頁

舉報

0/150
提交
取消
課程須知
1、需具備Java面向對象的基礎 2、需學習《JAVA實現(xiàn)Base64加密》課程的第一章,了解Java加解密的基礎知識。奉上鏈接:http://idcbgp.cn/learn/285
老師告訴你能學到什么?
1、掌握對稱加密算法在Java中的實現(xiàn) 2、了解對稱加密算法的應用場景

微信掃碼,參與3人拼團

微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網(wǎng)的支持!