Exemplo n.º 1
0
  /* (non-Javadoc)
   * @see bluecrystal.applet.sign.SignAppletP11#sign(int, int, java.lang.String, java.lang.String, java.lang.String)
   */
  @Override
  public String sign(int store, int alg, String userPIN, String certAlias, String orig) {

    String ret = "";
    p11.setUserPIN(userPIN);
    p11.setCertAlias(certAlias);
    p11.setOrig(orig);
    p11.setAlg(alg);
    p11.setStore(store);

    System.out.println("*** sign ***");
    System.out.println("userPIN: " + userPIN);
    System.out.println("certAlias: " + certAlias);
    System.out.println("orig: " + orig);
    System.out.println("alg: " + alg);
    System.out.println("store: " + store);
    mySynch.countDown();

    try {
      mySynch.getEnded();
      this.msg = "assinatura realizada";
      ret = p11.getResult();
    } catch (InterruptedException e) {
      this.msg = "problema na assinatura.";
      e.printStackTrace();
    }

    this.repaint();
    if (p11.getLastError().length() != 0) {
      return p11.getLastError();
    }

    return ret;
  }
Exemplo n.º 2
0
  /* (non-Javadoc)
   * @see bluecrystal.applet.sign.SignAppletP11#loadCerts(int, java.lang.String, java.lang.String)
   */
  @Override
  public String listCerts(int store, String userPIN) {
    try {
      p11.setUserPIN(userPIN);
      p11.setStore(store);
      mySynch.startLC();
      mySynch.awaitLC2();

      String ret = "";

      ret = p11.loadCertsJson();
      if (p11.getLastError() != null && p11.getLastError().length() != 0) {
        return p11.getLastError();
      }
      return ret;

    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    return "";
  }