equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1997-2009 Sun Microsystems, Inc. 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. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
90 |
90 |
91 /* Are we debugging? -- for developers */ |
91 /* Are we debugging? -- for developers */ |
92 static final boolean debug = false; |
92 static final boolean debug = false; |
93 |
93 |
94 static final SecureRandom RANDOM = new SecureRandom(); |
94 static final SecureRandom RANDOM = new SecureRandom(); |
95 |
|
96 // After the SunJCE passed self-integrity checking, |
|
97 // verifiedSelfIntegrity will be set to true. |
|
98 private static boolean verifiedSelfIntegrity = false; |
|
99 |
95 |
100 public SunJCE() { |
96 public SunJCE() { |
101 /* We are the "SunJCE" provider */ |
97 /* We are the "SunJCE" provider */ |
102 super("SunJCE", 1.7d, info); |
98 super("SunJCE", 1.7d, info); |
103 |
99 |
439 |
435 |
440 return null; |
436 return null; |
441 } |
437 } |
442 }); |
438 }); |
443 } |
439 } |
444 |
|
445 // set to true once self verification is complete |
|
446 private static volatile boolean integrityVerified; |
|
447 |
|
448 static void ensureIntegrity(Class c) { |
|
449 if (verifySelfIntegrity(c) == false) { |
|
450 throw new SecurityException("The SunJCE provider may have " + |
|
451 "been tampered."); |
|
452 } |
|
453 } |
|
454 |
|
455 static final boolean verifySelfIntegrity(Class c) { |
|
456 if (verifiedSelfIntegrity) { |
|
457 return true; |
|
458 } |
|
459 return (integrityVerified = JarVerifier.verify(c)); |
|
460 } |
|
461 } |
440 } |