question: public void sign ( KeyPair keypair ) throws IOException { if ( namelist . isEmpty ( ) ) { throw new IllegalStateException ( "No domain was set" ) ; } if ( keypair == null ) { throw new IllegalArgumentException ( "keypair must not be null" ) ; } try { GeneralName [ ] gns = new GeneralName [ namelist . size ( ) ] ; for ( int ix = 0 ; ix < namelist . size ( ) ; ix ++ ) { gns [ ix ] = new GeneralName ( GeneralName . dNSName , namelist . get ( ix ) ) ; } GeneralNames subjectAltName = new GeneralNames ( gns ) ; PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder ( namebuilder . build ( ) , keypair . getPublic ( ) ) ; ExtensionsGenerator extensionsGenerator = new ExtensionsGenerator ( ) ; extensionsGenerator . addExtension ( Extension . subjectAlternativeName , false , subjectAltName ) ; p10Builder . addAttribute ( PKCSObjectIdentifiers . pkcs_9_at_extensionRequest , extensionsGenerator . generate ( ) ) ; PrivateKey pk = keypair . getPrivate ( ) ; JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder ( pk instanceof ECKey ? EC_SIGNATURE_ALG : SIGNATURE_ALG ) ; ContentSigner signer = csBuilder . build ( pk ) ; csr = p10Builder . build ( signer ) ; } catch ( OperatorCreationException ex ) { throw new IOException ( "Could not generate CSR" , ex ) ; } }
target:  Signs the completed CSR.