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 .