/**
   * Retrieve the encryption Certificate used by a particular channel in a File.
   *
   * @param channel The Channel.
   * @return The certificate file.
   */
  static File getCertFile(ChannelInfo channel) throws Throwable {
    ICertificateManagerObj certMgr = ServiceLookupHelper.getCertificateManager();

    Certificate cert =
        certMgr.findCertificateByUID(channel.getSecurityProfile().getEncryptionCertificateID());
    String filename =
        FileUtil.getFile(IPathConfig.PATH_TEMP, "").getAbsolutePath() + "/myCert.cert";

    GridCertUtilities.writeX509Certificate(
        filename,
        GridCertUtilities.loadX509Certificate(GridCertUtilities.decode(cert.getCertificate())));

    return new File(filename);
  }