Package com.encryption

Examples of com.encryption.DesEncrypter


    SecretKey key;
    try {
      key = KeyGenerator.getInstance("DES").generateKey();

      // Create encrypter/decrypter class
      DesEncrypter encrypter = new DesEncrypter(key);
      // Encrypt
      File encryptedFile = new File(uploadFile.getAbsolutePath() + ".des");
      encrypter.encrypt(new FileInputStream(uploadFile),
          new FileOutputStream(encryptedFile));

      /*
       * 利用公钥加密DES密钥
       */
 
View Full Code Here


     * 根据数据密钥,构造DesEncrypter对象
     */
    // Create encrypter/decrypter class
    SecretKeySpec key = new SecretKeySpec(dataKey, "DES");

    DesEncrypter decrypter = new DesEncrypter(key);

    /*
     * DesEncrypter对象调用解密模块,解密出原始文件
     */
    File decryptedFile = new File(file.getAbsolutePath() + ".dec");
    InputStream in = null;
    try {
      decrypter.decrypt(new FileInputStream(file), new FileOutputStream(
          decryptedFile));
      /*
       * 返回封装了原始文件的输入流
       */
      in = new FileInputStream(decryptedFile);
View Full Code Here

TOP

Related Classes of com.encryption.DesEncrypter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.