예제 #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;
  }
예제 #2
0
 @Override
 public String getSubject(String alias) {
   try {
     return p11.getSubject(alias);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return "ERROR";
 }
예제 #3
0
  @Override
  public int getKeySize(String alias) {
    try {
      return p11.getKeySize(alias);

    } catch (Exception e) {
      e.printStackTrace();
    }
    return -1;
  }
예제 #4
0
 /* (non-Javadoc)
  * @see bluecrystal.applet.sign.SignAppletP11#getCert(java.lang.String)
  */
 @Override
 public String getCertificate(String alias) {
   try {
     String cert = p11.getCert(alias);
     return cert;
   } catch (Throwable e) {
     e.printStackTrace();
   }
   return null;
 }
예제 #5
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 "";
  }