Package java.security

Examples of java.security.Provider$EngineDescription


    SunJCE = checkUse("use.SunJCE") ? Security.getProvider("SunJCE") : null;
  }
  static private class BouncyCastleLoader {
    private BouncyCastleLoader() {}
    private Provider load() throws Throwable {
      Provider p = Security.getProvider("BC");
      if (p == null) {
        try {
          Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
          p = (Provider)c.newInstance();
          Security.addProvider(p);
View Full Code Here


    }
  }
  static private class NSSLoader {
    private NSSLoader() {}
    private Provider load(boolean atfirst) throws Throwable {
      Provider nssProvider = null;
      for(Provider p: java.security.Security.getProviders()) {
        if (p.getName().matches("^SunPKCS11-(?i)NSS.*$")) {
          nssProvider = p;
          break;
        }
View Full Code Here

  /** @return null if JCA is crippled (restricted to 128-bit) so we need
   * to use this class. */
  private static Provider getAesCtrProvider() {
    try {
      final String algo = "AES/CTR/NOPADDING";
      final Provider bcastle = JceLoader.BouncyCastle;
      final Class<?> clazz = Rijndael.class;

      byte[] key = new byte[32]; // Test for whether 256-bit works.
      byte[] iv = new byte[16];
      byte[] plaintext = new byte[16];
      SecretKeySpec k = new SecretKeySpec(key, "AES");
      IvParameterSpec IV = new IvParameterSpec(iv);

      Cipher c = Cipher.getInstance(algo);
      c.init(Cipher.ENCRYPT_MODE, k, IV);
      // ^^^ resolve provider
      Provider provider = c.getProvider();
      if (bcastle != null) {
        // BouncyCastle provider is faster (in some configurations)
        try {
          Cipher bcastle_cipher = Cipher.getInstance(algo, bcastle);
          bcastle_cipher.init(Cipher.ENCRYPT_MODE, k, IV);
          Provider bcastle_provider = bcastle_cipher.getProvider();
          if (provider != bcastle_provider) {
            long time_def = benchmark(c, k, IV);
            long time_bcastle = benchmark(bcastle_cipher, k, IV);
            System.out.println(algo + " (" + provider + "): " + time_def + "ns");
            System.out.println(algo + " (" + bcastle_provider + "): " + time_bcastle + "ns");
View Full Code Here

     * @throws NoSuchProviderException
     */
    public static PublicKey publicToExplicitParameters(PublicKey key, String providerName)
        throws IllegalArgumentException, NoSuchAlgorithmException, NoSuchProviderException
    {
        Provider provider = Security.getProvider(providerName);

        if (provider == null)
        {
            throw new NoSuchProviderException("cannot find provider: " + providerName);
        }
View Full Code Here

     * @throws NoSuchProviderException
     */
    public static PrivateKey privateToExplicitParameters(PrivateKey key, String providerName)
        throws IllegalArgumentException, NoSuchAlgorithmException, NoSuchProviderException
    {
        Provider provider = Security.getProvider(providerName);

        if (provider == null)
        {
            throw new NoSuchProviderException("cannot find provider: " + providerName);
        }
View Full Code Here

     * return a more "meaningful" representation for the signature algorithm used in
     * the certficate.
     */
    public String getSigAlgName()
    {
        Provider    prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME);

        if (prov != null)
        {
            String      algName = prov.getProperty("Alg.Alias.Signature." + this.getSigAlgOID());

            if (algName != null)
            {
                return algName;
            }
View Full Code Here

     * return a more "meaningful" representation for the signature algorithm used in
     * the certficate.
     */
    public String getSigAlgName()
    {
        Provider    prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME);

        if (prov != null)
        {
            String      algName = prov.getProperty("Alg.Alias.Signature." + this.getSigAlgOID());

            if (algName != null)
            {
                return algName;
            }
View Full Code Here

    }

    static Provider getProvider(String provider)
        throws NoSuchProviderException
    {
        Provider prov = Security.getProvider(provider);

        if (prov == null)
        {
            throw new NoSuchProviderException("Provider " + provider + " not found");
        }
View Full Code Here

    @SuppressWarnings("PMD.EmptyCatchBlock")
    public void loadKeyStore() throws Exception
    {
        if ( Strings.isEmpty( keystoreFile ) )
        {
            Provider provider = Security.getProvider( "SUN" );
            LOG.debug( "provider = {}", provider );
            CoreKeyStoreSpi coreKeyStoreSpi = new CoreKeyStoreSpi( getDirectoryService() );
            keyStore = new KeyStore( coreKeyStoreSpi, provider, "JKS" )
            {
            };
View Full Code Here


    public void setLdapServer( LdapServer ldapServer )
    {
        LOG.debug( "Setting LDAP Service" );
        Provider provider = Security.getProvider( "SUN" );
        LOG.debug( "provider = {}", provider );

        try
        {
            sslContext = SSLContext.getInstance( "TLS" );
View Full Code Here

TOP

Related Classes of java.security.Provider$EngineDescription

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.