欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    JAVA 密码算法报告.docx

    • 资源ID:60140098       资源大小:27.54KB        全文页数:10页
    • 资源格式: DOCX        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    JAVA 密码算法报告.docx

    Java暗号  目的本JAVA言語用、共通鍵暗号方式暗号化、復号作成最終目標。Java言語()  所要年数、総預金額計算(a) 課題毎年一定金額預、目標金額達上回年数時総預金額提示作成。(b) 作成public class Calculation public static void main(String args)int goal;int deposit;int amount = 0;int years = 0;try goal = Integer.parseInt(args0); System.out.println("目標金額:"+goal+"円"); deposit = Integer.parseInt(args1); System.out.println("毎年預金額:"+deposit+"円"); while(amount < goal)amount += deposit;years+; System.out.println("所要年数:"+years+"年"); System.out.println("総預金額:"+amount+"円");catch(Exception ex) ex.printStackTrace(); (c) 実行結果目標金額:10000円毎年総預金額:1500円所要年数:7年総預金額:10500円()  標準出力(a) 課題 文字列標準出力作成、後、自分名字字指定、実行。System.out.println代System.out.print、System.out.write(buf)代System.out.write(buf,off,len)使用、StdOutSample.java結果同一StdOutPrac.java作成。、実行行、StdOutSample.jav同結果確認。、以下変数buf格納長(int型)、buf.length得。length。(b) StdOutSample実行結果String標準出力: roka配列標準出力: roka(c) 変更public class StdOutParc public static void main(String args)String dataP;String dataW;byte buf = new byte100;try dataP = args0; System.out.print("String標準出力:"+dataP+"n"); dataW = "配列標準出力:"+args0+"n" buf = dataW.getBytes(); System.out.write(buf, 0, buf.length);catch(Exception ex) ex.printStackTrace(); (d) StdOutPrac実行結果String標準出力:roka配列標準出力:roka例外処理()  同一(a) 課題Exception.java作成、後、以下三種類順次指定実行、結果記録。-1, 50, 100class ArgException extends Exceptionpublic class Except public static void main(String args)try total(Integer.parseInt(args0);catch(ArgException e) System.out.println(":"+e); public static void total(int n) throws ArgExceptionint sum = 0;if(n < 0 | n > 100)throw new ArgException();for(int i = 1; i <= n; i+) sum += i;System.out.println("合計 = "+sum); (b) 実行結果ArgException合計1275合計5050()  異(a) 課題 上記以下部分分割、実行。作成Exception.java及含別配下行。(参考文献2)(b) 分割class ArgException extends Exceptionpublic class ExceptMain public static void main(String args)try ExceptSub.total(Integer.parseInt(args0);catch(ArgException e) System.out.println(":"+e); public class ExceptSub public static void total(int n) throws ArgException int sum = 0; if(n < 0 | n > 100)throw new ArgException(); for(int i = 1; i < n; i+) sum += i;System.out.println("合計 = "+sum); (c) 実行結果ArgException合計1275合計5050入出力処理() 文字列入出力(a) 課題文字列入出力行FileRW作成、実行。、入力(内容自由、日本語記述)作成。、入力文字数出力文字数関係記録、相違有無確認。更、相違場合、理由記述。(b) 実行結果入力文:大阪工業大学文字数合計:6入力文:大阪工業大学情報科学部文字数合計:12(c) 実行結果考察大阪工業大学一行6文字、大阪工業大学¥情報科学部複数行合計12文字。、改行加算、一文字増。()  列入出力(a) 課題 FileInputStream、FileOutputStream使用(StreamRW.java)作成。但、FileRW.java文字数数置換。、読込出力(while内)System.out.write使用。、入力作成(文字列入出力使用使用)。(b) 作成import java.io.*;public class StreamRW public static void main(String args)byte buff = new byte10;int length = 0;int totalLen = 0;try FileInputStream streamRd = new FileInputStream(args0); FileOutputStream streamWt = new FileOutputStream(args1); System.out.println("入力文:"); while(length = streamRd.read(buff) != -1)totalLen = totalLen + length;streamWt.write(buff,0,length);System.out.write(buff,0,length); System.out.println(""); System.out.println("数合計:"+totalLen); streamRd.close(); streamWt.close();catch(Exception ex) ex.printStackTrace(); (c) 実行結果入力文:大阪工業大学情報科学部数合計:35() 入出力(a) 課題 Struct入出力行以下(ObjectIO.java)示箇所補、完成。、後、実行行。本Struct生成後、出力後、入力、入力実行。(b) 作成/Object: 文字列文字列長import java.io.*; public class Struct implements Serializableprivate String str;private int leng;public Struct(String str) this.str = str; this.leng = str.length();public void print() System.out.println("文字列:"+str); System.out.println("文字列長:"+leng); import java.io.*; public class ObjectIOpublic static void main(String args) Struct obj = new Struct(args0); System.out.println("Object生成。"); obj.print(); tryFileOutputStream outFile = new FileOutputStream(args1);ObjectOutputStream outStream = new ObjectOutputStream(outFile);outStream.writeObject(obj);System.out.println("Object書込。");outStream.close(); catch(Exception ex)ex.printStackTrace();System.exit(1); tryFileInputStream inFile = new FileInputStream(args1);ObjectInputStream inStream = new ObjectInputStream(inFile);Struct var = (Struct)inStream.readObject();System.out.println("Object読込。");obj.print();inStream.close(); catch(Exception ex)ex.printStackTrace();System.exit(1); (c) 実行結果Object生成。文字列:abc文字列長: 3Object書込。Object読込。文字列: abc文字列長: 3共通鍵暗号方式暗号化、復号()  共通鍵生成(a) 課題任意暗号対共通鍵生成。KeyGen作成、鍵種類変実行。暗号名、鍵、鍵名受取、指定暗号、鍵持共通鍵生成、鍵出力。、内容標準出力。(b) 作成import java.io.*;import javax.crypto.*;class KeyGen public static void main(String args) tryKeyGenerator kg = KeyGenerator.getInstance(args0);System.out.println("暗号名"+ args0 + "。"); kg.init(Integer.parseInt(args1);SecretKey skey = kg.generateKey();System.out.println("鍵"+args1+"");FileOutputStream fos = new FileOutputStream(args2);ObjectOutputStream b = new ObjectOutputStream(fos);b.writeObject(skey);System.out.println("共通鍵"+args2 +"。");b.close(); catch(Exception e)e.printStackTrace(); (c) 実行結果 暗号名AES。鍵128。共通鍵AES.txt。()  暗号化、復号(a) 課題分割操作任意共通鍵暗号暗号化復号(i) 暗号化、入力文書名、共通鍵名、暗号文名受取、文書暗号化、暗号文格納。、暗号名標準出力。(ii) 復号、暗号文名、共通鍵名、復号結果名受取、暗号文復号、復号結果格納。、暗号名標準出力。(b) 作成(i)  暗号化import java.io.*;import javax.crypto.*;class Encrypt public static void main(String args) byte buf = new byte500;byte encrypted = new byte500;int length = 0;try FileInputStream in = new FileInputStream(args0); FileInputStream f = new FileInputStream(args1); ObjectInputStream ob = new ObjectInputStream(f); SecretKey k = (SecretKey)ob.readObject();/共通鍵読込 Cipher cipher = Cipher.getInstance(k.getAlgorithm();cipher.init(Cipher.ENCRYPT_MODE,k);System.out.println("暗号名"+ k.getAlgorithm() + "。");FileOutputStream out = new FileOutputStream(args2); /*暗号化*/ while(length = in.read(buf) != -1)encrypted = cipher.update(buf, 0, length);out.write(encrypted); encrypted = cipher.doFinal(); out.write(encrypted); / args2書込 in.close(); ob.close(); out.close();catch(Exception e) e.printStackTrace(); (ii)  復号import java.io.*;import javax.crypto.*;class Decrypt public static void main(String args) byte buf = new byte500;byte encrypted = new byte500;int length = 0;try FileInputStream in = new FileInputStream(args0); FileInputStream f = new FileInputStream(args1); ObjectInputStream ob = new ObjectInputStream(f); SecretKey k = (SecretKey)ob.readObject(); /共通鍵読込 Cipher cipher = Cipher.getInstance(k.getAlgorithm(); cipher.init(Cipher.DECRYPT_MODE,k); System.out.println("復号名"+ k.getAlgorithm() + "。"); FileOutputStream out = new FileOutputStream(args2);/*復号*/ while(length = in.read(buf) != -1)encrypted = cipher.update(buf, 0, length);out.write(encrypted); encrypted = cipher.doFinal(); out.write(encrypted); / args2書込 in.close(); ob.close(); out.close();catch(Exception e) e.printStackTrace(); (c) 実行結果(i)  暗号化暗号名AES。(ii)  復号復号名AES。考察() Java移植性優言。理由記述。移植性異環境再利用評価尺度性質一。異環境移起動移植性高。Java時Java呼中間生成、JavaJava VMJava実行環境実行可能機械語。、Java VM各種(UNIX/LINUX/Macintosh/Windows)用準備。言換Java VM各種差吸収。結果、Windows作成UNIX上移、実行。、Java移植性優。() 世中暗号技術使用例挙、暗号技術使方状況記述。電子使。利用際、互認証必要。自分情報第三者漏、暗号化。、電子取引署名暗号技術例一。署名通常3。一公開鍵生成鍵生成。一、利用者秘密鍵用署名生成、利用者公開鍵用署名検証。署名生成処理作出"署名"呼。実用性、署名私解決願全問題単独解決訳。暗号技術、安全環境、人安心見。参考文献():”連載一覧始JAVA”,http:/www.atmarkit.co.jp/fjava/index/index_javaent.html所感三週間勉強通、最低限知用語簡単習。普通呼意味通文章数列平文呼。平文何手段、第三者意味通行為暗号化呼。暗号化文章暗号文、暗号文平文戻復号呼。、JAVA基本的使方、暗号処理必要例外処理、入出力処理勉強。理解上、共通鍵方式、暗号化、復号処理。暗号技術、見、自分情報盗難可能性低。取引時署名電子認証、詐欺避、自分情報守、環境。

    注意事项

    本文(JAVA 密码算法报告.docx)为本站会员(飞****2)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开