edu.nyu.cs.pdsg.drbac
Class CredentialCert

java.lang.Object
  extended byedu.nyu.cs.pdsg.drbac.CredentialCert

public class CredentialCert
extends java.lang.Object

A class to abstract signing and verifying certificates from any one algorithm. This means the code we write can ignore the algorithm used. CredentialCert makes up for a nasty workaround I had to add in the previous revision to make this abstaraction. This is somewhat akin to the CertificateFactory class in the new Java cert impl.


Field Summary
static java.math.BigInteger G
           
static java.math.BigInteger P
           
static java.math.BigInteger Q
           
static java.lang.String scheme
           
 
Constructor Summary
CredentialCert()
           
 
Method Summary
static byte[] sign(byte[] data, java.security.PrivateKey key)
          sign an array of bytes
static boolean verify(byte[] signature, byte[] data, java.security.PublicKey key)
          verify a signature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheme

public static final java.lang.String scheme
See Also:
Constant Field Values

G

public static final java.math.BigInteger G

P

public static final java.math.BigInteger P

Q

public static final java.math.BigInteger Q
Constructor Detail

CredentialCert

public CredentialCert()
Method Detail

sign

public static byte[] sign(byte[] data,
                          java.security.PrivateKey key)
                   throws java.security.SignatureException,
                          java.security.InvalidKeyException
sign an array of bytes

Parameters:
data - the array of bytes to be signed
key - the key to sign with
Returns:
the signature bytes
Throws:
java.security.InvalidKeyException - if the key is invalid
java.security.SignatureException - for any other signature problems

verify

public static boolean verify(byte[] signature,
                             byte[] data,
                             java.security.PublicKey key)
                      throws java.security.SignatureException
verify a signature

Parameters:
signature - the signature bytes
data - the data to verify the signature of
key - the key to be verified
Returns:
the validity of the signature
Throws:
java.security.InvalidKeyException - if the key is invalid
java.security.SignatureException - for any other signature problems


Copyright (c) 2002-2003 New York University RLAB