bees.core
Class SignedXdrByteArray
java.lang.Object
|
+--bees.core.ByteArray
|
+--bees.core.XdrByteArray
|
+--bees.core.SignedXdrByteArray
- public class SignedXdrByteArray
- extends XdrByteArray
A SignedXdrByteArray is a convenience for signing/verifying an XdrByteArray.
- See Also:
Signature
Field Summary |
static int |
TIMESTAMP
The length of an encoded TIMESTAMP element. |
Constructor Summary |
SignedXdrByteArray(byte[] buf,
byte[] signature,
java.lang.String algorithm)
Construct a SignedXdrByteArray with the given values. |
SignedXdrByteArray(byte[] buf,
java.lang.String algorithm)
Construct a SignedXdrByteArray with the given values. |
SignedXdrByteArray(int len,
java.lang.String algorithm)
Construct a SignedXdrByteArray with the given values. |
Methods inherited from class bees.core.XdrByteArray |
BOOLEAN, BYTE, BYTEARRAY, BYTES, BYTES, DOUBLE, FLOAT, INT, LEINT, LELONG, LESHORT, LONG, PUT, PUT, PUT, PUT, PUT, PUT, PUT, PUT, PUT, PUT, PUT, PUTLE, PUTLE, PUTLE, SHORT, SKIP, STRING |
Methods inherited from class bees.core.ByteArray |
concat, concat, fromFile, getByte, getBytes, length, setByte, setBytes, setBytes, toBytes, toFile, toPlainString, toPlainString, toString, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TIMESTAMP
public static final int TIMESTAMP
- The length of an encoded TIMESTAMP element.
SignedXdrByteArray
public SignedXdrByteArray(int len,
java.lang.String algorithm)
- Construct a SignedXdrByteArray with the given values.
- Parameters:
len
- The length of the byte array.algorithm
- The name of the cryptographic algorithm to use.
SignedXdrByteArray
public SignedXdrByteArray(byte[] buf,
java.lang.String algorithm)
- Construct a SignedXdrByteArray with the given values.
- Parameters:
buf
- The byte array to wrap.algorithm
- The name of the cryptographic algorithm to use.
SignedXdrByteArray
public SignedXdrByteArray(byte[] buf,
byte[] signature,
java.lang.String algorithm)
- Construct a SignedXdrByteArray with the given values.
- Parameters:
buf
- The byte array to wrap.signature
- The signature covering "buf".algorithm
- The name of the cryptographic algorithm to use.
getAlgorithm
public java.lang.String getAlgorithm()
- Returns:
- The name of the cryptographic algorithm to use.
getSignature
public byte[] getSignature()
- Returns:
- The signature covering "buf".
sign
public void sign(PrivateKeySpec pk,
ProtocolSession ps)
throws java.lang.SecurityException,
java.security.SignatureException,
java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
- Parameters:
pk
- The PrivateKey to use when signing this byte array.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 "ps" is null and this domain is not an
application.java.security.SignatureException
- if there was a problem signing the byte
array.java.security.InvalidKeyException
- if the given key is invalid.java.security.NoSuchAlgorithmException
- if the algorithm given in the
constructor is invalid.
sign
public void sign(PrivateKeySpec pk)
throws java.lang.SecurityException,
java.security.SignatureException,
java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
- Parameters:
pk
- The PrivateKey to use when signing this byte array.- Throws:
java.lang.SecurityException
- if this domain is not an application.java.security.SignatureException
- if there was a problem signing the byte
array.java.security.InvalidKeyException
- if the given key is invalid.java.security.NoSuchAlgorithmException
- if the algorithm given in the
constructor is invalid.
verify
public boolean verify(PublicKeySpec pk,
ProtocolSession ps)
throws java.security.SignatureException,
java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
- Parameters:
pk
- The PublicKeySpec to use when verifying this byte array.ps
- A ProtocolSession from the flow this signature was bound to or
null if it was not bound to a flow.- Returns:
- True if the signature verified against the byte array.
- Throws:
java.security.SignatureException
- if there was a problem signing the byte
array.java.security.InvalidKeyException
- if the given key is invalid.java.security.NoSuchAlgorithmException
- if the algorithm given in the
constructor is invalid.
verify
public boolean verify(PublicKeySpec pk)
throws java.security.SignatureException,
java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
- Parameters:
pk
- The PublicKeySpec to use when verifying this byte array.- Returns:
- True if the signature verified against the byte array.
- Throws:
java.security.SignatureException
- if there was a problem signing the byte
array.java.security.InvalidKeyException
- if the given key is invalid.java.security.NoSuchAlgorithmException
- if the algorithm given in the
constructor is invalid.
PUT
public void PUT(Clock clock)
TIMESTAMP
public boolean TIMESTAMP(Clock clock,
long tolerance)
toString
public java.lang.String toString()
- Overrides:
toString
in class XdrByteArray
- Following copied from class:
bees.core.ByteArray
- See Also:
Object.toString()
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/