Package java.security.Provider

Examples of java.security.Provider.Service


    private static String getPrngAlgorithm() {
  List provs = Providers.getProviderList().providers();
  for (Iterator t = provs.iterator(); t.hasNext();) {
      Provider p = (Provider)t.next();
      for (Iterator u = p.getServices().iterator(); u.hasNext();) {
    Service s = (Service)u.next();
    if (s.getType().equals("SecureRandom")) {
        return s.getAlgorithm();
    }
      }
  }
  return null;
    }
View Full Code Here


        (algorithm + " Signature not available");
  }
  // try services until we find an Spi or a working Signature subclass
  NoSuchAlgorithmException failure;
  do {
      Service s = (Service)t.next();
      if (isSpi(s)) {
    return new Delegate(s, t, algorithm);
      } else {
    // must be a subclass of Signature, disable dynamic selection
    try {
View Full Code Here

    // return an implementation for NONEwithRSA, which is a special case
    // because of the Cipher.RSA/ECB/PKCS1Padding compatibility wrapper
    private static Signature getInstanceRSA(Provider p)
      throws NoSuchAlgorithmException {
  // try Signature first
  Service s = p.getService("Signature", RSA_SIGNATURE);
  if (s != null) {
      Instance instance = GetInstance.getInstance(s, SignatureSpi.class);
      return getInstance(instance, RSA_SIGNATURE);
  }
  // check Cipher
View Full Code Here

      new Exception("Call trace").printStackTrace();
        }
    }
    Exception lastException = null;
    while ((firstService != null) || serviceIterator.hasNext()) {
        Service s;
        if (firstService != null) {
      s = firstService;
      firstService = null;
        } else {
      s = (Service)serviceIterator.next();
        }
        if (isSpi(s) == false) {
      continue;
        }
        try {
      sigSpi = newInstance(s);
      provider = s.getProvider();
      // not needed any more
      firstService = null;
      serviceIterator = null;
      return;
        } catch (NoSuchAlgorithmException e) {
View Full Code Here

        init(sigSpi, type, key, random);
        return;
    }
    Exception lastException = null;
    while ((firstService != null) || serviceIterator.hasNext()) {
        Service s;
        if (firstService != null) {
      s = firstService;
      firstService = null;
        } else {
      s = (Service)serviceIterator.next();
        }
        // if provider says it does not support this key, ignore it
        if (s.supportsParameter(key) == false) {
      continue;
        }
        // if instance is not a SignatureSpi, ignore it
        if (isSpi(s) == false) {
      continue;
        }
        try {
      SignatureSpi spi = newInstance(s);
      init(spi, type, key, random);
      provider = s.getProvider();
      sigSpi = spi;
      firstService = null;
      serviceIterator = null;
      return;
        } catch (Exception e) {
View Full Code Here

        (algorithm + " KeyPairGenerator not available");
  }
  // find a working Spi or KeyPairGenerator subclass
  NoSuchAlgorithmException failure = null;
  do {
      Service s = t.next();
      try {
    Instance instance =
        GetInstance.getInstance(s, KeyPairGeneratorSpi.class);
    if (instance.impl instanceof KeyPairGenerator) {
        return getInstance(instance, algorithm);
View Full Code Here

    }
    if (serviceIterator == null) {
        return null;
    }
    while (serviceIterator.hasNext()) {
        Service s = serviceIterator.next();
        try {
      Object inst = s.newInstance(null);
      // ignore non-spis
      if (inst instanceof KeyPairGeneratorSpi == false) {
          continue;
      }
      if (inst instanceof KeyPairGenerator) {
          continue;
      }
      KeyPairGeneratorSpi spi = (KeyPairGeneratorSpi)inst;
      if (reinit) {
          if (initType == I_SIZE) {
        spi.initialize(initKeySize, initRandom);
          } else if (initType == I_PARAMS) {
        spi.initialize(initParams, initRandom);
          } else if (initType != I_NONE) {
        throw new AssertionError
            ("KeyPairGenerator initType: " + initType);
          }
      }
      provider = s.getProvider();
      this.spi = spi;
      return spi;
        } catch (Exception e) {
      // ignore
        }
View Full Code Here

      }
      if (serviceIterator == null) {
    return null;
      }
      while (serviceIterator.hasNext()) {
    Service s = serviceIterator.next();
    try {
        Object obj = s.newInstance(null);
        if (obj instanceof KeyFactorySpi == false) {
      continue;
        }
        KeyFactorySpi spi = (KeyFactorySpi)obj;
        provider = s.getProvider();
        this.spi = spi;
        return spi;
    } catch (NoSuchAlgorithmException e) {
        // ignore
    }
View Full Code Here

                (algorithm + " Signature not available");
        }
        // try services until we find an Spi or a working Signature subclass
        NoSuchAlgorithmException failure;
        do {
            Service s = t.next();
            if (isSpi(s)) {
                return new Delegate(s, t, algorithm);
            } else {
                // must be a subclass of Signature, disable dynamic selection
                try {
View Full Code Here

    // return an implementation for NONEwithRSA, which is a special case
    // because of the Cipher.RSA/ECB/PKCS1Padding compatibility wrapper
    private static Signature getInstanceRSA(Provider p)
            throws NoSuchAlgorithmException {
        // try Signature first
        Service s = p.getService("Signature", RSA_SIGNATURE);
        if (s != null) {
            Instance instance = GetInstance.getInstance(s, SignatureSpi.class);
            return getInstance(instance, RSA_SIGNATURE);
        }
        // check Cipher
View Full Code Here

TOP

Related Classes of java.security.Provider.Service

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.