Bees v0.5.0 API

bees.core.security
Class Signature

java.lang.Object
  |
  +--bees.core.security.Signature

public final class Signature
extends java.lang.Object

Signature is a thin veneer over the standard java.security.Signature class that uses bees.core.security classes.

Note: In order to prevent downloaded code from producing signatures for arbitrary data, the flow identifier is always added to the signature.


Field Summary
static Permission SIGN_PERMISSION
          Permission to use this key for signing.
static Permission VERIFY_PERMISSION
          Permission to use this key for verification.
 
Constructor Summary
Signature(java.lang.String algorithm)
          Construct a Signature object that uses the given algorithm type.
 
Method Summary
 java.lang.String getAlgorithm()
           
 java.lang.Object getParameter(java.lang.String param)
           
 void initSign(PrivateKeySpec privateKey)
          Initialize the signature object for signing.
 void initSign(PrivateKeySpec privateKey, ProtocolSession ps)
          Initialize the signature object for signing.
 void initSign(PrivateKeySpec privateKey, java.security.SecureRandom random)
          Initialize the signature object for signing.
 void initSign(PrivateKeySpec privateKey, java.security.SecureRandom random, ProtocolSession ps)
          Initialize the signature object for signing.
 void initVerify(PublicKeySpec publicKey)
          Initialize the signature object for verification.
 void initVerify(PublicKeySpec publicKey, ProtocolSession ps)
          Initialize the signature object for verification.
 void setParameter(java.security.spec.AlgorithmParameterSpec params)
           
 void setParameter(java.lang.String param, java.lang.Object value)
           
 byte[] sign()
           
 int sign(byte[] outbuf, int offset, int len)
           
 java.lang.String toString()
           
 void update(byte b)
           
 void update(byte[] data)
           
 void update(byte[] data, int off, int len)
           
 boolean verify(byte[] signature)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIGN_PERMISSION

public static final Permission SIGN_PERMISSION
Permission to use this key for signing.

VERIFY_PERMISSION

public static final Permission VERIFY_PERMISSION
Permission to use this key for verification.
Constructor Detail

Signature

public Signature(java.lang.String algorithm)
          throws java.security.NoSuchAlgorithmException
Construct a Signature object that uses the given algorithm type.
Parameters:
algorithm - The name of the algorithm to use when signing/verifying.
Throws:
java.security.NoSuchAlgorithmException - if the given algorithm is not supported.
Method Detail

initVerify

public void initVerify(PublicKeySpec publicKey,
                       ProtocolSession ps)
                throws java.security.InvalidKeyException,
                       java.security.SignatureException
Initialize the signature object for verification.
Parameters:
publicKey - The public key of the identity whose signature is going to be verified.
ps - A ProtocolSession from the flow this signature was bound to or null if this domain is an application.
Throws:
java.security.SignatureException - if there was a problem adding the flow identifier to the Signature.
java.security.InvalidKeyException - if the given key is invalid.

initVerify

public void initVerify(PublicKeySpec publicKey)
                throws java.security.InvalidKeyException
Initialize the signature object for verification.
Parameters:
publicKey - The public key of the identity whose signature is going to be verified.
Throws:
java.security.InvalidKeyException - if the given key is invalid.

initSign

public void initSign(PrivateKeySpec privateKey)
              throws java.lang.SecurityException,
                     java.security.InvalidKeyException
Initialize the signature object for signing.
Parameters:
privateKey - The private key of the identity whose signature is going to be generated.
Throws:
java.lang.SecurityException - if this domain is not an application.
java.security.InvalidKeyException - if the given key is invalid.

initSign

public void initSign(PrivateKeySpec privateKey,
                     java.security.SecureRandom random)
              throws java.lang.SecurityException,
                     java.security.InvalidKeyException
Initialize the signature object for signing.
Parameters:
privateKey - The private key of the identity whose signature is going to be generated.
random - The source of randomness for this signature.
Throws:
java.lang.SecurityException - if this domain is not an application.
java.security.InvalidKeyException - if the given key is invalid.

initSign

public void initSign(PrivateKeySpec privateKey,
                     ProtocolSession ps)
              throws java.lang.SecurityException,
                     java.security.InvalidKeyException,
                     java.security.SignatureException
Initialize the signature object for signing.
Parameters:
privateKey - The private key of the identity whose signature is going to be generated.
ps - A ProtocolSession from the flow this signature should be bound to or null if this domain is an application.
Throws:
java.lang.SecurityException - if this domain is not an application.
java.security.InvalidKeyException - if the given key is invalid.
java.security.SignatureException - if there was a problem updating the signature with the flow identifier.

initSign

public void initSign(PrivateKeySpec privateKey,
                     java.security.SecureRandom random,
                     ProtocolSession ps)
              throws java.lang.SecurityException,
                     java.security.InvalidKeyException,
                     java.security.SignatureException
Initialize the signature object for signing.
Parameters:
privateKey - The private key of the identity whose signature is going to be generated.
ps - A ProtocolSession from the flow this signature should be bound to or null if this domain is an application.
random - The source of randomness for this signature.
Throws:
java.lang.SecurityException - if this domain is not an application.
java.security.InvalidKeyException - if the given key is invalid.
java.security.SignatureException - if there was a problem updating the signature with the flow identifier.

sign

public byte[] sign()
            throws java.security.SignatureException

sign

public int sign(byte[] outbuf,
                int offset,
                int len)
         throws java.security.SignatureException

verify

public boolean verify(byte[] signature)
               throws java.security.SignatureException

update

public void update(byte b)
            throws java.security.SignatureException

update

public void update(byte[] data)
            throws java.security.SignatureException

update

public void update(byte[] data,
                   int off,
                   int len)
            throws java.security.SignatureException

getAlgorithm

public java.lang.String getAlgorithm()

setParameter

public void setParameter(java.lang.String param,
                         java.lang.Object value)
                  throws java.security.InvalidParameterException

setParameter

public void setParameter(java.security.spec.AlgorithmParameterSpec params)
                  throws java.security.InvalidAlgorithmParameterException

getParameter

public java.lang.Object getParameter(java.lang.String param)
                              throws java.security.InvalidParameterException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/