Examples of AppDescriptorException


Examples of com.sun.midp.jadtool.AppDescriptorException

        String sigAlgName;

        if (signee_alias == null || signing_alias == null ||
            keyPass == null || keyStore == null) {
            throw new AppDescriptorException("signACert got a null argument",
                                             4);
        }
       
        Object[] objs = recoverPrivateKey(signing_alias, storePass,
                                          keyPass, keyStore);
        PrivateKey privKey = (PrivateKey)objs[0];
        if (keyPass == null)
            keyPass = (char[])objs[1];
       
        // Determine the signature algorithm
        // If no signature algorithm was specified at the command line,
        // we choose one that is compatible with the selected private key
        String keyAlgName = privKey.getAlgorithm();
        if (keyAlgName.equalsIgnoreCase("DSA")
            || keyAlgName.equalsIgnoreCase("DSS")) {
            sigAlgName = "SHA1WithDSA";
        } else if (keyAlgName.equalsIgnoreCase("RSA")) {
            sigAlgName = "SHA1WithRSA";
        } else {
            throw new
                AppDescriptorException("Cannot derive signature algorithm", 5);
        }

        // Get the old certificate
        Certificate oldCert = keyStore.getCertificate(signee_alias);
        if (oldCert == null) {
            throw new
                AppDescriptorException(signee_alias + " has no public key", 4);
        }

        if (!(oldCert instanceof X509Certificate)) {
            throw new AppDescriptorException(signee_alias +
                " has no X.509 certificate", 6);
        }
       
        // Get the "signing" certificate
        Certificate signingCert = keyStore.getCertificate(signing_alias);
        if (signingCert == null) {
            throw new
                AppDescriptorException(signee_alias + " has no public key", 7);
        }

        if (!(signingCert instanceof X509Certificate)) {
            throw new AppDescriptorException(signee_alias +
                " has no X.509 certificate", 8);
        }      

        // convert to X509CertImpl, so that we can modify selected fields
        // (no public APIs available yet)
View Full Code Here

Examples of com.sun.midp.jadtool.AppDescriptorException

               UnrecoverableKeyException {

        String urlStr = getProperty(JAR_URL);

        if (urlStr == null) {
            throw new AppDescriptorException(JAR_URL + " not in descriptor");
        }

        URL url = new URL(urlStr);
        InputStream jarStream = url.openStream();
        addJarSignature(alias, keypass, jarStream);
View Full Code Here

Examples of com.sun.midp.jadtool.AppDescriptorException

     */   
    private Certificate[] getCertificatesFromKeyStore(String alias)
    throws AppDescriptorException, CertificateException, KeyStoreException {

  if (keystore == null) {
      throw new AppDescriptorException(
      AppDescriptorException.KEYSTORE_NOT_INITIALIZED);
  }

  // Return a certifcate chain if we can get it.
  Certificate[] chain = keystore.getCertificateChain(alias);
View Full Code Here

Examples of com.sun.midp.jadtool.AppDescriptorException

               AppDescriptorException {

        Certificate cert;

        if (keystore == null) {
            throw new AppDescriptorException(
                AppDescriptorException.KEYSTORE_NOT_INITIALIZED);
        }

        // Load a keystore data structure to get keys from     
        cert = keystore.getCertificate(alias);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.