class CertificateManager {

  public synchronized SecurityStore generateContainerKeystore(String hostname,
                                                              String requesterId,
                                                              String role,
                                                              String keystorePass)
      throws SliderException {
    LOG.info("Generation of container keystore for container {} on {}",
             requesterId, hostname);

    generateContainerCertificate(hostname, requesterId);

    // come up with correct args to invoke keystore command
    String srvrCrtPass = SecurityUtils.getKeystorePass();
    String srvrKstrDir = SecurityUtils.getSecurityDir();
    String containerCrtName = requesterId + ".crt";
    String containerKeyName = requesterId + ".key";
    String kstrName = getKeystoreFileName(requesterId, role);

    Object[] scriptArgs = {srvrCrtPass, keystorePass, srvrKstrDir,
        containerKeyName, containerCrtName, kstrName};

    String command = MessageFormat.format(EXPRT_KSTR, scriptArgs);
    runCommand(command);

    return new SecurityStore(new File(srvrKstrDir, kstrName),
                             SecurityStore.StoreType.keystore);
  }

}