Package java.security

Examples of java.security.NoSuchAlgorithmException


        this.provider = provider;
        this.interfaceDigest = interfaceDigest;
        // message digest
        digestAlgorithmOid = DigestAlgorithms.getAllowedDigests(hashAlgorithm);
        if (digestAlgorithmOid == null)
            throw new NoSuchAlgorithmException(MessageLocalization.getComposedMessage("unknown.hash.algorithm.1", hashAlgorithm));

        // Copy the certificates
        signCert = (X509Certificate)certChain[0];
        certs = new ArrayList<Certificate>();
        for (Certificate element : certChain) {
            certs.add(element);
        }


        // initialize and add the digest algorithms.
        digestalgos = new HashSet<String>();
        digestalgos.add(digestAlgorithmOid);
       
        // find the signing algorithm (RSA or DSA)
        if (privKey != null) {
            digestEncryptionAlgorithmOid = privKey.getAlgorithm();
            if (digestEncryptionAlgorithmOid.equals("RSA")) {
                digestEncryptionAlgorithmOid = SecurityIDs.ID_RSA;
            }
            else if (digestEncryptionAlgorithmOid.equals("DSA")) {
                digestEncryptionAlgorithmOid = SecurityIDs.ID_DSA;
            }
            else {
                throw new NoSuchAlgorithmException(MessageLocalization.getComposedMessage("unknown.key.algorithm.1", digestEncryptionAlgorithmOid));
            }
        }
       
        // initialize the RSA data
        if (hasRSAdata) {
View Full Code Here


            }
            else if (digestEncryptionAlgorithm.equals("ECDSA")) {
                this.digestEncryptionAlgorithmOid = SecurityIDs.ID_ECDSA;
            }
            else
                throw new ExceptionConverter(new NoSuchAlgorithmException(MessageLocalization.getComposedMessage("unknown.key.algorithm.1", digestEncryptionAlgorithm)));
        }
    }
View Full Code Here

  if (!found) {
      if (mech) {
                throw new NoSuchMechanismException("Mechanism type " + alg
             + " not available");
      } else {
                throw new NoSuchAlgorithmException("Algorithm type " + alg
             + " not available");
      }
        }
        return entry;
    }
View Full Code Here

    if (mech) {
              throw new NoSuchMechanismException
      ("no such mechanism type: " + alg + " for provider " +
       provider.getName());
    } else {
              throw new NoSuchAlgorithmException
      ("no such algorithm: " + alg + " for provider " +
             provider.getName());
    }
      }
        }
View Full Code Here

    if (mech) {
        throw new NoSuchMechanismException
      ("class configured for " + type + ": " + className +
             " not a " + type);
    } else {
        throw new NoSuchAlgorithmException
      ("class configured for " + type + ": " + className +
             " not a " + type);
    }
      }
  } catch (ClassNotFoundException e) {
      if (mech) {
          throw new NoSuchMechanismException
        ("class configured for " + type + "(provider: " +
               providerName + ")" + "cannot be found.\n", e);
      } else {
          throw (NoSuchAlgorithmException) new NoSuchAlgorithmException
        ("class configured for " + type + "(provider: " +
               providerName + ")" + "cannot be found.\n").initCause(e);
      }
  } catch (InstantiationException e) {
      if (mech) {
          throw new NoSuchMechanismException
        ("class " + className + " configured for " + type +
                     "(provider: " + providerName + ") cannot be " +
                     "instantiated. ", e);
      } else {
          throw (NoSuchAlgorithmException) new NoSuchAlgorithmException
        ("class " + className + " configured for " + type +
                     "(provider: " + providerName + ") cannot be " +
                     "instantiated. ").initCause(e);
      }
  } catch (IllegalAccessException e) {
      if (mech) {
          throw new NoSuchMechanismException
        ("class " + className + " configured for " + type +
                     "(provider: " + providerName +
                     ") cannot be accessed.\n", e);
      } else {
          throw (NoSuchAlgorithmException) new NoSuchAlgorithmException
        ("class " + className + " configured for " + type +
                     "(provider: " + providerName +
                     ") cannot be accessed.\n").initCause(e);
      }
  }
View Full Code Here

        } else if (algorithm.equals(DigestMethod.SHA256)) {
            return DOMSHADigestMethod.SHA256(params);
        } else if (algorithm.equals(DigestMethod.SHA512)) {
            return DOMSHADigestMethod.SHA512(params);
  } else {
      throw new NoSuchAlgorithmException("unsupported algorithm");
  }
    }
View Full Code Here

        } else if (algorithm.equals(SignatureMethod.RSA_SHA1)) {
            return new DOMRSASignatureMethod(params);
        } else if (algorithm.equals(SignatureMethod.DSA_SHA1)) {
            return new DOMDSASignatureMethod(params);
  } else {
      throw new NoSuchAlgorithmException("unsupported algorithm");
  }
    }
View Full Code Here

            }
            else if (responseType.equalsIgnoreCase(CertificateHelper.RESPONSETYPE_PKCS7WITHCHAIN)) {
              responseTypeInt = SecConst.CERT_RES_TYPE_PKCS7WITHCHAIN;
            }
            else{
              throw new NoSuchAlgorithmException ("Bad responseType:" + responseType);
            }
          }

          return new CertificateResponse(responseType, certificateRequestSession.processCertReq(admin, userdatavo, requestData, requestType, hardTokenSN, responseTypeInt));
        } catch( CADoesntExistsException t ) {
View Full Code Here

    if(submessage.getKeyAlg() == PKCS12Request.KEYALG_RSA){
      keyalg = AlgorithmConstants.KEYALGORITHM_RSA;
    } else if(submessage.getKeyAlg() == PKCS12Request.KEYALG_ECDSA){
        keyalg = AlgorithmConstants.KEYALGORITHM_ECDSA;
    } else {
      throw new NoSuchAlgorithmException("Wrong Key Algorithm specified.");
    }
    retval = KeyTools.genKeys(submessage.getKeySpec(), keyalg);

    return retval;
  }
View Full Code Here

        super();
        TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
        factory.init(keystore);
        TrustManager[] trustmanagers = factory.getTrustManagers();
        if (trustmanagers.length == 0) {
            throw new NoSuchAlgorithmException("no trust manager found");
        }
        standardTrustManager = (X509TrustManager)trustmanagers[0];
    }
View Full Code Here

TOP

Related Classes of java.security.NoSuchAlgorithmException

Copyright © 2018 www.massapicom. 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.