Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Signaturejava.security

Java 1.1


This class computes or verifies a
digital signature. Obtain a Signature object by
calling one of the static getInstance( )
factory methods and specifying the desired digital signature
algorithm and, optionally, the desired provider of that algorithm. A

digital signature is essentially a message
digest encrypted by a public-key encryption algorithm. Thus, to
specify a digital signature algorithm, you must specify both the
digest algorithm and the encryption algorithm. The only algorithm
supported by the default "SUN"
provider is "SHA1withDSA".

Once you
have obtained a Signature object, you must
initialize it before you can create or verify a digital signature. To
initialize a digital signature for creation, call initSign(
) and specify the private key to be used to create the
signature. To initialize a signature for verification, call
initVerify( ) and specify the public key of the
signer. Once the Signature object has been
initialized, call update( ) one or more times to
specify the data to be signed or verified. Prior to Java 5.0, the
data must be specified as an array of bytes. In Java 5.0 and later,
you can also pass a ByteBuffer to update(
), and this facilitates the use of the
Signature class with the
java.nio package.

Finally, to create a digital signature, call
sign( ), passing
a byte array into which the signature is stored. Or, pass the bytes
of the digital signature to verify( ), which
returns true if the signature is valid or
false otherwise. After calling either
sign( ) or verify( ), the
Signature object is reset internally and can be
used to create or verify another signature.


Figure 14-39. java.security.Signature

public abstract class

Signature extends SignatureSpi {
// Protected Constructors
protected

Signature (String

algorithm );
// Protected Constants
protected static final int

SIGN ; =2
protected static final int

UNINITIALIZED ; =0
protected static final int

VERIFY ; =3
// Public Class Methods
public static Signature

getInstance (String

algorithm )
throws NoSuchAlgorithmException;

1.4 public static Signature

getInstance (String

algorithm , Provider

provider )
throws NoSuchAlgorithmException;
public static Signature

getInstance (String

algorithm , String

provider )
throws NoSuchAlgorithmException, NoSuchProviderException;
// Public Instance Methods
public final String

getAlgorithm ( );

1.4 public final AlgorithmParameters

getParameters ( );

1.2 public final Provider

getProvider ( );
public final void

initSign (PrivateKey

privateKey )
throws InvalidKeyException;

1.2 public final void

initSign (PrivateKey

privateKey , SecureRandom

random )
throws InvalidKeyException;

1.3 public final void

initVerify (java.security.cert.Certificate

certificate )
throws InvalidKeyException;
public final void

initVerify (PublicKey

publicKey )
throws InvalidKeyException;

1.2 public final void

setParameter (java.security.spec.
AlgorithmParameterSpec

params )
throws InvalidAlgorithmParameterException;
public final byte[ ]

sign ( ) throws SignatureException;

1.2 public final int

sign (byte[ ]

outbuf , int

offset , int

len ) throws SignatureException;

5.0 public final void

update (java.nio.ByteBuffer

data ) throws SignatureException;
public final void

update (byte

b ) throws SignatureException;
public final void

update (byte[ ]

data ) throws SignatureException;
public final void

update (byte[ ]

data , int

off , int

len )
throws SignatureException;
public final boolean

verify (byte[ ]

signature ) throws SignatureException;

1.4 public final boolean

verify (byte[ ]

signature , int

offset , int

length )
throws SignatureException;
// Public Methods Overriding SignatureSpi
public Object

clone ( ) throws CloneNotSupportedException;
// Public Methods Overriding Object
public String

toString ( );
// Protected Instance Fields
protected int

state ;
// Deprecated Public Methods

# public final Object

getParameter (String

param )
throws InvalidParameterException;

# public final void

setParameter (String

param , Object

value )
throws InvalidParameterException;
}


Passed To


SignedObject.{SignedObject( ), verify(
)}


    / 1191