Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/security/KeyPairGenerator.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* KeyPairGenerator.java --- Key Pair Generator Class
    2    Copyright (C) 1999 Free Software Foundation, Inc.
     2   Copyright (C) 1999 Free Software Foundation, Inc.
    33
    44This file is part of GNU Classpath.
     
    3737
    3838package java.security;
     39
    3940import java.security.spec.AlgorithmParameterSpec;
    4041
     
    5253public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
    5354{
    54   private Provider provider;
     55  Provider provider;
    5556  private String algorithm;
    5657
     
    8485     @return a AlgorithmParameterGenerator repesenting the desired algorithm
    8586
    86      @throws NoSuchAlgorithmException if the algorithm is not implemented by providers
     87     @throws NoSuchAlgorithmException if the algorithm is not implemented by
     88                                      providers
    8789   */
    8890  public static KeyPairGenerator getInstance(String algorithm) throws
     
    9193    Provider[] p = Security.getProviders();
    9294
    93     String name = "KeyPairGenerator." + algorithm;
    9495    for (int i = 0; i < p.length; i++)
    9596      {
    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) {}
    99102      }
    100103
     
    111114     @return a AlgorithmParameterGenerator repesenting the desired algorithm
    112115
    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
    114118     @throws NoSuchProviderException if the provider is not found
    115119   */
     
    119123    Provider p = Security.getProvider(provider);
    120124    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);
    125153  }
    126154
     
    135163        KeyPairGenerator kpg;
    136164        if (o instanceof KeyPairGeneratorSpi)
    137           kpg =
    138             (KeyPairGenerator) (new
    139                                 DummyKeyPairGenerator((KeyPairGeneratorSpi) o,
    140                                                       algorithm));
     165          kpg = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm);
    141166        else
    142167          {
Note: See TracChangeset for help on using the changeset viewer.