- 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/Signature.java (modified) (11 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/Signature.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 1 /* Signature.java --- Signature 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. … … 59 59 1. Initialing 60 60 61 * It must be initialized with a private key for 62 signing. 63 * It must be initialized with a public key for 64 verifying. 61 * It must be initialized with a private key for signing. 62 * It must be initialized with a public key for verifying. 65 63 66 64 2. Updating 67 65 68 Update the bytes for signing or verifying with calls 69 to update. 66 Update the bytes for signing or verifying with calls to update. 70 67 71 68 3. Signing or Verify the signature on the currently stored … … 101 98 102 99 private String algorithm; 103 privateProvider provider;100 Provider provider; 104 101 105 102 /** … … 114 111 } 115 112 116 /** 113 /** 117 114 Gets an instance of the Signature class representing 118 115 the specified signature. If the algorithm is not found then, … … 122 119 @return a Signature repesenting the desired algorithm 123 120 124 @throws NoSuchAlgorithmException if the algorithm is not implemented by providers 121 @throws NoSuchAlgorithmException if the algorithm is not implemented by 122 providers 125 123 */ 126 124 public static Signature getInstance(String algorithm) 127 125 throws NoSuchAlgorithmException 128 126 { 129 String name = "Signature." + algorithm;130 127 Provider[] p = Security.getProviders(); 131 128 132 129 for (int i = 0; i < p.length; i++) 133 130 { 134 String classname = p[i].getProperty(name); 135 if (classname != null) 136 return getInstance(classname, algorithm, p[i]); 131 try 132 { 133 return getInstance(algorithm, p[i]); 134 } 135 catch (NoSuchAlgorithmException ignored) {} 137 136 } 138 137 … … 151 150 @return a Signature repesenting the desired algorithm 152 151 153 @throws NoSuchAlgorithmException if the algorithm is not implemented by the provider 152 @throws NoSuchAlgorithmException if the algorithm is not implemented by 153 the provider 154 154 @throws NoSuchProviderException if the provider is not found 155 155 */ … … 159 159 Provider p = Security.getProvider(provider); 160 160 if (p == null) 161 throw new NoSuchProviderException(); 162 163 return getInstance(p.getProperty("Signature." + algorithm), algorithm, p); 161 throw new NoSuchProviderException(provider); 162 163 return getInstance(algorithm, p); 164 } 165 166 private static Signature getInstance(String algorithm, Provider p) 167 throws NoSuchAlgorithmException 168 { 169 // try the name as is 170 String className = p.getProperty("Signature." + algorithm); 171 if (className == null) { // try all uppercase 172 String upper = algorithm.toUpperCase(); 173 className = p.getProperty("Signature." + upper); 174 if (className == null) { // try if it's an alias 175 String alias = p.getProperty("Alg.Alias.Signature." + algorithm); 176 if (alias == null) { 177 alias = p.getProperty("Alg.Alias.Signature." + upper); 178 if (alias == null) { // spit the dummy 179 throw new NoSuchAlgorithmException(algorithm); 180 } 181 } 182 className = p.getProperty("Signature." + alias); 183 if (className == null) { 184 throw new NoSuchAlgorithmException(algorithm); 185 } 186 } 187 } 188 return getInstance(className, algorithm, p); 164 189 } 165 190 … … 174 199 Signature sig; 175 200 if (o instanceof SignatureSpi) 176 sig = (Signature) (new DummySignature((SignatureSpi) o, algorithm));201 sig = ); 177 202 else 178 203 { … … 201 226 Gets the provider that the Signature is from. 202 227 203 @return the provider the this Signature228 @return the provider 204 229 */ 205 230 public final Provider getProvider() … … 311 336 signatures. 312 337 313 @param outbuf farray of bytes338 @param outbuf array of bytes 314 339 @param offset the offset to start at in the array 315 340 @param len the length of the bytes to put into the array. … … 326 351 @since JDK 1.2 327 352 */ 328 public final int sign(byte[] outbuf, int offset, int len)353 public final int sign(byte[]outbuf, int offset, int len) 329 354 throws SignatureException 330 355 { -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
