jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java
changeset 7043 5e2d1edeb2c7
parent 5506 202f599c92aa
child 10336 0bb1999251f8
equal deleted inserted replaced
7042:56e990297bc5 7043:5e2d1edeb2c7
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   762                                 if (cfs.containsKey(certType)) {
   762                                 if (cfs.containsKey(certType)) {
   763                                 // reuse certificate factory
   763                                 // reuse certificate factory
   764                                     cf = (CertificateFactory)cfs.get(certType);
   764                                     cf = (CertificateFactory)cfs.get(certType);
   765                                 } else {
   765                                 } else {
   766                                 // create new certificate factory
   766                                 // create new certificate factory
   767                                     cf = CertificateFactory.getInstance(certType);
   767                                     cf = CertificateFactory.getInstance(
       
   768                                         certType);
   768                                 // store the certificate factory so we can
   769                                 // store the certificate factory so we can
   769                                 // reuse it later
   770                                 // reuse it later
   770                                     cfs.put(certType, cf);
   771                                     cfs.put(certType, cf);
   771                                 }
   772                                 }
   772                             }
   773                             }
   861                     computed = md.digest();
   862                     computed = md.digest();
   862                     actual = new byte[computed.length];
   863                     actual = new byte[computed.length];
   863                     dis.readFully(actual);
   864                     dis.readFully(actual);
   864                     for (int i = 0; i < computed.length; i++) {
   865                     for (int i = 0; i < computed.length; i++) {
   865                         if (computed[i] != actual[i]) {
   866                         if (computed[i] != actual[i]) {
   866                             throw new IOException("Keystore was tampered with, or "
   867                             throw new IOException(
   867                                                   + "password was incorrect");
   868                                 "Keystore was tampered with, or "
       
   869                                 + "password was incorrect");
   868                         }
   870                         }
   869                     }
   871                     }
   870                 }
   872                 }
   871             }  finally {
   873             }  finally {
   872                 if (ois != null) {
   874                 if (ois != null) {