public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime,
        GSIConstants.CertificateType certType, X509ExtensionSet extSet, String cnValue) throws GeneralSecurityException {

        X509Certificate[] bcCerts = getX509CertificateObjectChain(certs);

        KeyPairGenerator keyGen = null;
        keyGen = KeyPairGenerator.getInstance("RSA", "BC");
        keyGen.initialize(bits);
        KeyPair keyPair = keyGen.genKeyPair();

        X509Certificate newCert = createProxyCertificate(bcCerts[0], privateKey, keyPair.getPublic(), lifetime,
            certType, extSet, cnValue);

        X509Certificate[] newCerts = new X509Certificate[bcCerts.length + 1];
        newCerts[0] = newCert;
        System.arraycopy(certs, 0, newCerts, 1, certs.length);

        return new X509Credential(keyPair.getPrivate(), newCerts);
    }
public X509Credential createCredential ( X509Certificate [ ] certs , PrivateKey privateKey , int bits , int lifetime , GSIConstants . CertificateType certType , X509ExtensionSet extSet , String cnValue ) throws GeneralSecurityException { X509Certificate [ ] bcCerts = getX509CertificateObjectChain ( certs ) ; KeyPairGenerator keyGen = null ; keyGen = KeyPairGenerator . getInstance ( "RSA" , "BC" ) ; keyGen . initialize ( bits ) ; KeyPair keyPair = keyGen . genKeyPair ( ) ; X509Certificate newCert = createProxyCertificate ( bcCerts [ 0 ] , privateKey , keyPair . getPublic ( ) , lifetime , certType , extSet , cnValue ) ; X509Certificate [ ] newCerts = new X509Certificate [ bcCerts . length + 1 ] ; newCerts [ 0 ] = newCert ; System . arraycopy ( certs , 0 , newCerts , 1 , certs . length ) ; return new X509Credential ( keyPair . getPrivate ( ) , newCerts ) ; }
Creates a new proxy credential from the specified certificate chain and a private key. A set of X.509
extensions can be optionally included in the new proxy certificate. This function automatically creates
a "RSA"-based key pair.

@see #createProxyCertificate(X509Certificate, PrivateKey, PublicKey, int, int, X509ExtensionSet,
String) createProxyCertificate
@param certs
the certificate chain for the new proxy credential. The top-most certificate
<code>cert[0]</code> will be designated as the issuing certificate.
@param privateKey
the private key of the issuing certificate. The new proxy certificate will be signed with
that private key.
@param bits
the strength of the key pair for the new proxy certificate.
@param lifetime
lifetime of the new certificate in seconds. If 0 (or less then) the new certificate will
have the same lifetime as the issuing certificate.
@param certType
the type of proxy credential to create
@param extSet
a set of X.509 extensions to be included in the new proxy certificate. Can be null. If
delegation mode is {@link org.globus.gsi.GSIConstants.CertificateType#GSI_3_RESTRICTED_PROXY
GSIConstants.CertificateType.GSI_3_RESTRICTED_PROXY} or {@link org.globus.gsi.GSIConstants.CertificateType#GSI_4_RESTRICTED_PROXY
GSIConstants.CertificateType.GSI_4_RESTRICTED_PROXY} then
{@link org.globus.gsi.proxy.ext.ProxyCertInfoExtension ProxyCertInfoExtension} must be
present in the extension set.
@param cnValue
the value of the CN component of the subject of the new proxy credential. If null, the
defaults will be used depending on the proxy certificate type created.
@return <code>GlobusCredential</code> the new proxy credential.
@exception GeneralSecurityException
if a security error occurs.