Beispiel #1
0
  // Loads one of the built-in keys (media, platform, shared, testkey)
  public void loadKeys(String name) throws IOException, GeneralSecurityException {

    keySet = loadedKeys.get(name);
    if (keySet != null) return;

    keySet = new KeySet();
    keySet.setName(name);
    loadedKeys.put(name, keySet);

    if (KEY_NONE.equals(name)) return;

    progressHelper.progress(ProgressEvent.PRORITY_IMPORTANT, "Loading certificate and private key");

    // load the private key
    URL privateKeyUrl = getClass().getResource("/keys/" + name + ".pk8");
    keySet.setPrivateKey(readPrivateKey(privateKeyUrl, null));

    // load the certificate
    URL publicKeyUrl = getClass().getResource("/keys/" + name + ".x509.pem");
    keySet.setPublicKey(readPublicKey(publicKeyUrl));

    // load the signature block template
    URL sigBlockTemplateUrl = getClass().getResource("/keys/" + name + ".sbt");
    if (sigBlockTemplateUrl != null) {
      keySet.setSigBlockTemplate(readContentAsBytes(sigBlockTemplateUrl));
    }
  }