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/Signature.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* Signature.java --- Signature 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.
     
    5959   1. Initialing
    6060
    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.
    6563
    6664   2. Updating
    6765
    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.
    7067
    7168   3. Signing or Verify the signature on the currently stored
     
    10198
    10299  private String algorithm;
    103   private Provider provider;
     100  Provider provider;
    104101
    105102  /**
     
    114111  }
    115112
    116   /** 
     113  /**
    117114     Gets an instance of the Signature class representing
    118115     the specified signature. If the algorithm is not found then,
     
    122119     @return a Signature repesenting the desired algorithm
    123120
    124      @throws NoSuchAlgorithmException if the algorithm is not implemented by providers
     121     @throws NoSuchAlgorithmException if the algorithm is not implemented by
     122                                      providers
    125123   */
    126124  public static Signature getInstance(String algorithm)
    127125    throws NoSuchAlgorithmException
    128126  {
    129     String name = "Signature." + algorithm;
    130127    Provider[] p = Security.getProviders();
    131128
    132129    for (int i = 0; i < p.length; i++)
    133130      {
    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) {}
    137136      }
    138137
     
    151150     @return a Signature repesenting the desired algorithm
    152151
    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
    154154     @throws NoSuchProviderException if the provider is not found
    155155   */
     
    159159    Provider p = Security.getProvider(provider);
    160160    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);
    164189  }
    165190
     
    174199        Signature sig;
    175200        if (o instanceof SignatureSpi)
    176           sig = (Signature) (new DummySignature((SignatureSpi) o, algorithm));
     201          sig = );
    177202        else
    178203          {
     
    201226     Gets the provider that the Signature is from.
    202227
    203      @return the provider the this Signature
     228     @return the provider
    204229   */
    205230  public final Provider getProvider()
     
    311336     signatures.
    312337
    313      @param outbuff array of bytes
     338     @param outbuf array of bytes
    314339     @param offset the offset to start at in the array
    315340     @param len the length of the bytes to put into the array.
     
    326351     @since JDK 1.2
    327352   */
    328   public final int sign(byte[]outbuf, int offset, int len)
     353  public final int sign(byte[]outbuf, int offset, int len)
    329354    throws SignatureException
    330355  {
Note: See TracChangeset for help on using the changeset viewer.