OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [gnu/] [java/] [security/] [sig/] [ISignature.java] - Blame information for rev 769

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 769 jeremybenn
/* ISignature.java --
2
   Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
3
 
4
This file is a part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or (at
9
your option) any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19
USA
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version.  */
37
 
38
 
39
package gnu.java.security.sig;
40
 
41
import java.util.Map;
42
 
43
/**
44
 * The visible methods of every signature-with-appendix scheme.
45
 * <p>
46
 * The Handbook of Applied Cryptography (HAC), by A. Menezes &amp; al. states:
47
 * "Digital signature schemes which require the message as input to the
48
 * verification algorithm are called <i>digital signature schemes with appendix</i>.
49
 * ... They rely on cryptographic hash functions rather than customised
50
 * redundancy functions, and are less prone to existential forgery attacks."
51
 * <p>
52
 * References:
53
 * <ol>
54
 * <li><a href="http://www.cacr.math.uwaterloo.ca/hac/">Handbook of Applied
55
 * Cryptography</a>, Alfred J. Menezes, Paul C. van Oorschot and Scott A.
56
 * Vanstone. Section 11.2.2 Digital signature schemes with appendix.</li>
57
 * </ol>
58
 */
59
public interface ISignature
60
    extends Cloneable
61
{
62
  /** Property name of the verifier's public key. */
63
  public static final String VERIFIER_KEY = "gnu.crypto.sig.public.key";
64
 
65
  /** Property name of the signer's private key. */
66
  public static final String SIGNER_KEY = "gnu.crypto.sig.private.key";
67
 
68
  /**
69
   * Property name of an optional {@link java.security.SecureRandom},
70
   * {@link java.util.Random}, or {@link gnu.java.security.prng.IRandom}
71
   * instance to use. The default is to use a classloader singleton from
72
   * {@link gnu.java.security.util.PRNG}.
73
   */
74
  public static final String SOURCE_OF_RANDOMNESS = "gnu.crypto.sig.prng";
75
 
76
  /**
77
   * Returns the canonical name of this signature scheme.
78
   *
79
   * @return the canonical name of this instance.
80
   */
81
  String name();
82
 
83
  /**
84
   * Initialises this instance for signature verification.
85
   *
86
   * @param attributes the attributes to use for setting up this instance.
87
   * @throws IllegalArgumentException if the designated public key is not
88
   *           appropriate for this signature scheme.
89
   * @see #SOURCE_OF_RANDOMNESS
90
   * @see #VERIFIER_KEY
91
   */
92
  void setupVerify(Map attributes) throws IllegalArgumentException;
93
 
94
  /**
95
   * Initialises this instance for signature generation.
96
   *
97
   * @param attributes the attributes to use for setting up this instance.
98
   * @throws IllegalArgumentException if the designated private key is not
99
   *           appropriate for this signature scheme.
100
   * @see #SOURCE_OF_RANDOMNESS
101
   * @see #SIGNER_KEY
102
   */
103
  void setupSign(Map attributes) throws IllegalArgumentException;
104
 
105
  /**
106
   * Digests one byte of a message for signing or verification purposes.
107
   *
108
   * @param b the message byte to digest.
109
   * @throws IllegalStateException if this instance was not setup for signature
110
   *           generation/verification.
111
   */
112
  void update(byte b) throws IllegalStateException;
113
 
114
  /**
115
   * Digests a sequence of bytes from a message for signing or verification
116
   * purposes.
117
   *
118
   * @param buffer the byte sequence to consider.
119
   * @param offset the byte poisition in <code>buffer</code> of the first byte
120
   *          to consider.
121
   * @param length the number of bytes in <code>buffer</code> starting from
122
   *          the byte at index <code>offset</code> to digest.
123
   * @throws IllegalStateException if this instance was not setup for signature
124
   *           generation/verification.
125
   */
126
  void update(byte[] buffer, int offset, int length)
127
      throws IllegalStateException;
128
 
129
  /**
130
   * Terminates a signature generation phase by digesting and processing the
131
   * context of the underlying message digest algorithm instance.
132
   *
133
   * @return a {@link Object} representing the native output of the signature
134
   *         scheme implementation.
135
   * @throws IllegalStateException if this instance was not setup for signature
136
   *           generation.
137
   */
138
  Object sign() throws IllegalStateException;
139
 
140
  /**
141
   * Terminates a signature verification phase by digesting and processing the
142
   * context of the underlying message digest algorithm instance.
143
   *
144
   * @param signature a native signature object previously generated by an
145
   *          invocation of the <code>sign()</code> method.
146
   * @return <code>true</code> iff the outpout of the verification phase
147
   *         confirms that the designated signature object has been generated
148
   *         using the corresponding public key of the recepient.
149
   * @throws IllegalStateException if this instance was not setup for signature
150
   *           verification.
151
   */
152
  boolean verify(Object signature) throws IllegalStateException;
153
 
154
  /**
155
   * Returns a clone copy of this instance.
156
   *
157
   * @return a clone copy of this instance.
158
   */
159
  Object clone();
160
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.