public String generateCRL ( User registrar , Date revokedBefore , Date revokedAfter , Date expireBefore , Date expireAfter ) throws InvalidArgumentException , GenerateCRLException { if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "registrar is not set" ) ; } try { setUpSSL ( ) ; //--------------------------------------- JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( revokedBefore != null ) { factory . add ( "revokedBefore" , Util . dateToString ( revokedBefore ) ) ; } if ( revokedAfter != null ) { factory . add ( "revokedAfter" , Util . dateToString ( revokedAfter ) ) ; } if ( expireBefore != null ) { factory . add ( "expireBefore" , Util . dateToString ( expireBefore ) ) ; } if ( expireAfter != null ) { factory . add ( "expireAfter" , Util . dateToString ( expireAfter ) ) ; } if ( caName != null ) { factory . add ( HFCAClient . FABRIC_CA_REQPROP , caName ) ; } JsonObject jsonObject = factory . build ( ) ; StringWriter stringWriter = new StringWriter ( ) ; JsonWriter jsonWriter = Json . createWriter ( new PrintWriter ( stringWriter ) ) ; jsonWriter . writeObject ( jsonObject ) ; jsonWriter . close ( ) ; String body = stringWriter . toString ( ) ; //--------------------------------------- // send revoke request JsonObject ret = httpPost ( url + HFCA_GENCRL , body , registrar ) ; return ret . getString ( "CRL" ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; throw new GenerateCRLException ( e . getMessage ( ) , e ) ; } }
Generate certificate revocation list .