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();
}
}
Aggregations