src/java.base/share/classes/com/sun/crypto/provider/KeyProtector.java
changeset 51504 c9a3e3cac9c7
parent 51293 53c3b460503c
child 59158 438337c846fb
equal deleted inserted replaced
51503:0265a70ea2a5 51504:c9a3e3cac9c7
   308         PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
   308         PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
   309         SecretKey sKey = null;
   309         SecretKey sKey = null;
   310         Cipher cipher;
   310         Cipher cipher;
   311         try {
   311         try {
   312             sKey = new PBEKey(pbeKeySpec, "PBEWithMD5AndTripleDES", false);
   312             sKey = new PBEKey(pbeKeySpec, "PBEWithMD5AndTripleDES", false);
   313         pbeKeySpec.clearPassword();
   313             pbeKeySpec.clearPassword();
   314 
   314 
   315         // seal key
   315             // seal key
   316         PBEWithMD5AndTripleDESCipher cipherSpi;
   316             PBEWithMD5AndTripleDESCipher cipherSpi;
   317         cipherSpi = new PBEWithMD5AndTripleDESCipher();
   317             cipherSpi = new PBEWithMD5AndTripleDESCipher();
   318         cipher = new CipherForKeyProtector(cipherSpi, SunJCE.getInstance(),
   318             cipher = new CipherForKeyProtector(cipherSpi, SunJCE.getInstance(),
   319                                            "PBEWithMD5AndTripleDES");
   319                                                "PBEWithMD5AndTripleDES");
   320         cipher.init(Cipher.ENCRYPT_MODE, sKey, pbeSpec);
   320             cipher.init(Cipher.ENCRYPT_MODE, sKey, pbeSpec);
   321         } finally {
   321         } finally {
   322             if (sKey != null) sKey.destroy();
   322             if (sKey != null) sKey.destroy();
   323         }
   323         }
   324         return new SealedObjectForKeyProtector(key, cipher);
   324         return new SealedObjectForKeyProtector(key, cipher);
   325     }
   325     }