public HFCAInfo info ( ) throws InfoException , InvalidArgumentException { logger . debug ( format ( "info url:%s" , url ) ) ; if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } setUpSSL ( ) ; try { JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( caName != null ) { factory . add ( HFCAClient . FABRIC_CA_REQPROP , caName ) ; } JsonObject body = factory . build ( ) ; String responseBody = httpPost ( url + HFCA_INFO , body . toString ( ) , ( UsernamePasswordCredentials ) null ) ; logger . debug ( "response:" + responseBody ) ; JsonReader reader = Json . createReader ( new StringReader ( responseBody ) ) ; JsonObject jsonst = ( JsonObject ) reader . read ( ) ; boolean success = jsonst . getBoolean ( "success" ) ; logger . debug ( format ( "[HFCAClient] enroll success:[%s]" , success ) ) ; if ( ! success ) { throw new EnrollmentException ( format ( "FabricCA failed info %s" , url ) ) ; } JsonObject result = jsonst . getJsonObject ( "result" ) ; if ( result == null ) { throw new InfoException ( format ( "FabricCA info error - response did not contain a result url %s" , url ) ) ; } String caName = result . getString ( "CAName" ) ; String caChain = result . getString ( "CAChain" ) ; String version = null ; if ( result . containsKey ( "Version" ) ) { version = result . getString ( "Version" ) ; } String issuerPublicKey = null ; if ( result . containsKey ( "IssuerPublicKey" ) ) { issuerPublicKey = result . getString ( "IssuerPublicKey" ) ; } String issuerRevocationPublicKey = null ; if ( result . containsKey ( "IssuerRevocationPublicKey" ) ) { issuerRevocationPublicKey = result . getString ( "IssuerRevocationPublicKey" ) ; } logger . info ( format ( "CA Name: %s, Version: %s, issuerPublicKey: %s, issuerRevocationPublicKey: %s" , caName , caChain , issuerPublicKey , issuerRevocationPublicKey ) ) ; return new HFCAInfo ( caName , caChain , version , issuerPublicKey , issuerRevocationPublicKey ) ; } catch ( Exception e ) { InfoException ee = new InfoException ( format ( "Url:%s, Failed to get info" , url ) , e ) ; logger . error ( e . getMessage ( ) , e ) ; throw ee ; } }
Return information on the Fabric Certificate Authority . No credentials are needed for this API .