- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/security/KeyPairGenerator.java (modified) (8 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/security/KeyPairGenerator.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 1 /* KeyPairGenerator.java --- Key Pair Generator Class 2 Copyright (C) 1999 Free Software Foundation, Inc.2 Copyright (C) 1999 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 37 37 38 38 package java.security; 39 39 40 import java.security.spec.AlgorithmParameterSpec; 40 41 … … 52 53 public abstract class KeyPairGenerator extends KeyPairGeneratorSpi 53 54 { 54 privateProvider provider;55 Provider provider; 55 56 private String algorithm; 56 57 … … 84 85 @return a AlgorithmParameterGenerator repesenting the desired algorithm 85 86 86 @throws NoSuchAlgorithmException if the algorithm is not implemented by providers 87 @throws NoSuchAlgorithmException if the algorithm is not implemented by 88 providers 87 89 */ 88 90 public static KeyPairGenerator getInstance(String algorithm) throws … … 91 93 Provider[] p = Security.getProviders(); 92 94 93 String name = "KeyPairGenerator." + algorithm;94 95 for (int i = 0; i < p.length; i++) 95 96 { 96 String classname = p[i].getProperty(name); 97 if (classname != null) 98 return getInstance(classname, algorithm, p[i]); 97 try 98 { 99 return getInstance(algorithm, p[i]); 100 } 101 catch (NoSuchAlgorithmException ignored) {} 99 102 } 100 103 … … 111 114 @return a AlgorithmParameterGenerator repesenting the desired algorithm 112 115 113 @throws NoSuchAlgorithmException if the algorithm is not implemented by the provider 116 @throws NoSuchAlgorithmException if the algorithm is not implemented by 117 the provider 114 118 @throws NoSuchProviderException if the provider is not found 115 119 */ … … 119 123 Provider p = Security.getProvider(provider); 120 124 if (p == null) 121 throw new NoSuchProviderException(); 122 123 return getInstance(p.getProperty("KeyPairGenerator." + algorithm), 124 algorithm, p); 125 throw new NoSuchProviderException(provider); 126 127 return getInstance(algorithm, p); 128 } 129 130 private static KeyPairGenerator getInstance(String algorithm, Provider p) 131 throws NoSuchAlgorithmException 132 { 133 // try the name as is 134 String className = p.getProperty("KeyPairGenerator." + algorithm); 135 if (className == null) { // try all uppercase 136 String upper = algorithm.toUpperCase(); 137 className = p.getProperty("KeyPairGenerator." + upper); 138 if (className == null) { // try if it's an alias 139 String alias = p.getProperty("Alg.Alias.KeyPairGenerator." + algorithm); 140 if (alias == null) { // try all-uppercase alias name 141 alias = p.getProperty("Alg.Alias.KeyPairGenerator." + upper); 142 if (alias == null) { // spit the dummy 143 throw new NoSuchAlgorithmException(algorithm); 144 } 145 } 146 className = p.getProperty("KeyPairGenerator." + alias); 147 if (className == null) { 148 throw new NoSuchAlgorithmException(algorithm); 149 } 150 } 151 } 152 return getInstance(className, algorithm, p); 125 153 } 126 154 … … 135 163 KeyPairGenerator kpg; 136 164 if (o instanceof KeyPairGeneratorSpi) 137 kpg = 138 (KeyPairGenerator) (new 139 DummyKeyPairGenerator((KeyPairGeneratorSpi) o, 140 algorithm)); 165 kpg = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm); 141 166 else 142 167 { -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
