Package java.security

Examples of java.security.NoSuchAlgorithmException


    {
        if (kdf != null)
        {
            if (!algorithms.containsKey(algorithm))
            {
                throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm);
            }
           
            int    keySize = ((Integer)algorithms.get(algorithm)).intValue();

            DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, bigIntToBytes(result));
View Full Code Here


    protected void engineSetMode(
        String  mode)
        throws NoSuchAlgorithmException
    {
        throw new NoSuchAlgorithmException("can't support mode " + mode);
    }
View Full Code Here

        if (md.equals("NONE") || md.equals("ECB"))
        {
            return;
        }
       
        throw new NoSuchAlgorithmException("can't support mode " + mode);
    }
View Full Code Here

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

        try {
            super.setUp();
        } catch (Exception e) {
            // ignore if algorithm is not on the OS
            NoSuchAlgorithmException nsae = ObjectHelper.getException(NoSuchAlgorithmException.class, e);
            if (nsae != null) {
                canTest = false;

                // warn both through console as well as log that we can not run the test
                String name = System.getProperty("os.name");
                String message = nsae.getMessage();
                System.out.println("SunX509 is not avail on this platform [" + name + "] Testing is skipped! Real cause: " + message);
                log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
            } else {
                // some other error then throw it so the test can fail
                throw e;
View Full Code Here

            sshd.setCommandFactory(new ScpCommandFactory());
            sshd.setPasswordAuthenticator(new MyPasswordAuthenticator());
            sshd.start();
        } catch (Exception e) {
            // ignore if algorithm is not on the OS
            NoSuchAlgorithmException nsae = ObjectHelper.getException(NoSuchAlgorithmException.class, e);
            if (nsae != null) {
                canTest = false;

                // warn both through console as well as log that we can not run the test
                String name = System.getProperty("os.name");
                String message = nsae.getMessage();
                System.out.println("SunX509 is not avail on this platform [" + name + "] Testing is skipped! Real cause: " + message);
                log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
            } else {
                // some other error then throw it so the test can fail
                throw e;
View Full Code Here

        Logger log = getLogger();
        String jceAlgorithmName = getKeyAlgorithmFromURI(algoURI);
        if (DatatypeHelper.isEmpty(jceAlgorithmName)) {
            log.error("Mapping from algorithm URI '" + algoURI
                    + "' to key algorithm not available, key generation failed");
            throw new NoSuchAlgorithmException("Algorithm URI'" + algoURI + "' is invalid for key generation");
        }
        Integer keyLength = getKeyLengthFromURI(algoURI);
        if (keyLength == null) {
            log.error("Key length could not be determined from algorithm URI, can't generate key");
            throw new KeyException("Key length not determinable from algorithm URI, could not generate new key");
View Full Code Here

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

        } else if (algorithm.equals(DOMSignatureMethod.HMAC_SHA384)) {
            return new DOMHMACSignatureMethod.SHA384(params);
        } else if (algorithm.equals(DOMSignatureMethod.HMAC_SHA512)) {
            return new DOMHMACSignatureMethod.SHA512(params);
        } else {
            throw new NoSuchAlgorithmException("unsupported algorithm");
        }
    }
View Full Code Here

public class BouncyCastleDigest implements ExternalDigest {

    public MessageDigest getMessageDigest(String hashAlgorithm) throws GeneralSecurityException {
        String oid = DigestAlgorithms.getAllowedDigests(hashAlgorithm);
        if (oid == null)
            throw new NoSuchAlgorithmException(hashAlgorithm);
        if (oid.equals("1.2.840.113549.2.2")) { //MD2
            return new MD2.Digest();
        }
        else if (oid.equals("1.2.840.113549.2.5")) { //MD5
            return new MD5.Digest();
        }
        else if (oid.equals("1.3.14.3.2.26")) { //SHA1
            return new SHA1.Digest();
        }
        else if (oid.equals("2.16.840.1.101.3.4.2.4")) { //SHA224
            return new SHA224.Digest();
        }
        else if (oid.equals("2.16.840.1.101.3.4.2.1")) { //SHA256
            return new SHA256.Digest();
        }
        else if (oid.equals("2.16.840.1.101.3.4.2.2")) { //SHA384
            return new SHA384.Digest();
        }
        else if (oid.equals("2.16.840.1.101.3.4.2.3")) { //SHA512
            return new SHA512.Digest();
        }
        else if (oid.equals("1.3.36.3.2.2")) { //RIPEMD128
            return new RIPEMD128.Digest();
        }
        else if (oid.equals("1.3.36.3.2.1")) { //RIPEMD160
            return new RIPEMD160.Digest();
        }
        else if (oid.equals("1.3.36.3.2.3")) { //RIPEMD256
            return new RIPEMD256.Digest();
        }
        else if (oid.equals("1.2.643.2.2.9")) { //GOST3411
            return new GOST3411.Digest();
        }
        throw new NoSuchAlgorithmException(hashAlgorithm); //shouldn't get here
    }
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.