org.kth.pdc.grid.utility
Class ProxyGenerator

java.lang.Object
  extended by org.kth.pdc.grid.utility.ProxyGenerator

public class ProxyGenerator
extends Object

Generate a proxy certificate.


Constructor Summary
ProxyGenerator()
          itinnov, 15.9.2006
 
Method Summary
 X509Certificate createProxyFromCert(InputStream inCert, InputStream inCACert, InputStream inCAKey, String caPwd)
          Creates a proxy certificate from existing certificate
 X509Certificate[] createProxyFromCertReq(InputStream inCertReq, BufferedInputStream inUserCert, InputStream inUserKey, String pwd)
          Creates a proxy certificate from a certificate request
static org.bouncycastle.asn1.x509.SubjectKeyIdentifier createSubjectKeyId(PublicKey pubKey)
           
 X509Certificate getCertProxy()
          Getting created proxy certificate
 X509Certificate getx509Cert()
           
 void saveCertProxyTofile()
          Save proxy certificate to file
 void saveCertProxyTofile(String delegationID, String userDN)
          Save proxy certificate to file
 void setBits(int bits)
          Set the number of bits
 void setCertFile(String certFile)
          Set certificate file needed to create proxy
 void setKeyFile(String keyFile)
          Set key file needed to create proxy
 void setLifetime(int hours)
          Set the life time
 void setPathLength(int pathLength)
          Set path length of proxy
 void setProxyAslimited()
          Set proxy as limited proxy
 void setProxyFile(String proxyFile)
          Set proxyFile name
 void setProxyType(int proxyType)
          Set the proxy type
 byte[] x509MakeCert(byte[] inCertReq, String alterDN, byte[] issuerCert, byte[] issuerKey, String pwd, long validitytime)
           
 byte[] x509MakeProxyCert(byte[] inCertReq, byte[] inUserCert, byte[] inUserKey, String pwd, long validitytime)
          Creates a proxy certificate from a certificate request
 byte[] x509MakeProxyCert(byte[] inCertReq, byte[] inProxy, String password)
          Creates a proxy certificate from a certificate request and a proxy certificate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyGenerator

public ProxyGenerator()
itinnov, 15.9.2006

Method Detail

x509MakeProxyCert

public byte[] x509MakeProxyCert(byte[] inCertReq,
                                byte[] inUserCert,
                                byte[] inUserKey,
                                String pwd,
                                long validitytime)
Creates a proxy certificate from a certificate request

Parameters:
inCertReq - Certificate request
inUserCert - Issuer certificate
inUserKey - Issuer privateKey
pwd - Issuer password
Returns:
chaine of certificate containing proxy in first place

x509MakeProxyCert

public byte[] x509MakeProxyCert(byte[] inCertReq,
                                byte[] inProxy,
                                String password)
Creates a proxy certificate from a certificate request and a proxy certificate

Parameters:
inCertReq - Certificate request
inProxy - user proxy
pwd - Issuer password
Returns:
chaine of certificate containing proxy in first place

createProxyFromCertReq

public X509Certificate[] createProxyFromCertReq(InputStream inCertReq,
                                                BufferedInputStream inUserCert,
                                                InputStream inUserKey,
                                                String pwd)
Creates a proxy certificate from a certificate request

Parameters:
inCertReq - Certificate request
inUserCert - Issuer certificate
inUserKey - Issuer privateKey
pwd - Issuer password
Returns:
chaine of certificate containing proxy in first place

createProxyFromCert

public X509Certificate createProxyFromCert(InputStream inCert,
                                           InputStream inCACert,
                                           InputStream inCAKey,
                                           String caPwd)
                                    throws IOException,
                                           NoSuchAlgorithmException,
                                           NoSuchProviderException,
                                           InvalidKeyException,
                                           GeneralSecurityException
Creates a proxy certificate from existing certificate

Parameters:
inCert - User's certificate
inCACert - issuer certificate
inCAKey - issuer private key
caPwd - issuer password
Returns:
Created X509 proxy certificate
Throws:
IOException
NoSuchAlgorithmException
NoSuchProviderException
InvalidKeyException
GeneralSecurityException

getCertProxy

public X509Certificate getCertProxy()
Getting created proxy certificate

Returns:
x509 certificate

saveCertProxyTofile

public void saveCertProxyTofile()
                         throws IOException,
                                CertificateEncodingException
Save proxy certificate to file

Throws:
IOException
CertificateEncodingException

saveCertProxyTofile

public void saveCertProxyTofile(String delegationID,
                                String userDN)
                         throws IOException,
                                CertificateEncodingException
Save proxy certificate to file

Parameters:
delegationID - proxy delegation ID to be added in proxy file
userDN - the user DN to be added in proxy file
Throws:
IOException
CertificateEncodingException

setBits

public void setBits(int bits)
Set the number of bits

Parameters:
bits - number of bits

setLifetime

public void setLifetime(int hours)
Set the life time

Parameters:
hours - life time of proxy

setProxyType

public void setProxyType(int proxyType)
Set the proxy type

Parameters:
proxyType -

setProxyAslimited

public void setProxyAslimited()
Set proxy as limited proxy


setPathLength

public void setPathLength(int pathLength)
Set path length of proxy

Parameters:
pathLength -

setProxyFile

public void setProxyFile(String proxyFile)
Set proxyFile name

Parameters:
proxyFile - File name that proxy should be saved to

setKeyFile

public void setKeyFile(String keyFile)
Set key file needed to create proxy

Parameters:
keyFile -

setCertFile

public void setCertFile(String certFile)
Set certificate file needed to create proxy

Parameters:
certFile -

createSubjectKeyId

public static org.bouncycastle.asn1.x509.SubjectKeyIdentifier createSubjectKeyId(PublicKey pubKey)

x509MakeCert

public byte[] x509MakeCert(byte[] inCertReq,
                           String alterDN,
                           byte[] issuerCert,
                           byte[] issuerKey,
                           String pwd,
                           long validitytime)

getx509Cert

public X509Certificate getx509Cert()


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.