Search in sources :

Example 1 with Query

use of com.ingrian.security.nae.KMIPQueryFunction.Query in project CipherTrust_Application_Protection by thalescpl-io.

the class KMIPQuerySample method main.

public static void main(String[] args) throws Exception {
    if (args.length != 2) {
        usage();
    }
    // add Ingrian provider to the list of JCE providers
    Security.addProvider(new IngrianProvider());
    KMIPSession session = null;
    try {
        session = KMIPSession.getSession(new NAEClientCertificate(args[0], args[1].toCharArray()));
        // create list of Key Manager properties to query
        ArrayList<Query> query = new ArrayList<Query>();
        query.add(Query.QueryObjects);
        query.add(Query.QueryOperations);
        query.add(Query.QueryServerInformation);
        /* execute the query on the session */
        Map<Query, ArrayList<String>> queryResult2 = session.query(query);
        /* view the results */
        for (Query answer : queryResult2.keySet()) {
            System.out.println(answer.getPrintName() + ": " + queryResult2.get(answer));
        }
    } catch (Exception e) {
        System.out.println("The Cause is " + e.getMessage() + ".");
        e.printStackTrace();
    } finally {
        if (session != null)
            session.closeSession();
    }
}
Also used : Query(com.ingrian.security.nae.KMIPQueryFunction.Query) ArrayList(java.util.ArrayList) NAEClientCertificate(com.ingrian.security.nae.NAEClientCertificate) IngrianProvider(com.ingrian.security.nae.IngrianProvider) KMIPSession(com.ingrian.security.nae.KMIPSession)

Aggregations

IngrianProvider (com.ingrian.security.nae.IngrianProvider)1 Query (com.ingrian.security.nae.KMIPQueryFunction.Query)1 KMIPSession (com.ingrian.security.nae.KMIPSession)1 NAEClientCertificate (com.ingrian.security.nae.NAEClientCertificate)1 ArrayList (java.util.ArrayList)1