Java 8 Provider - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Provider class.

This code example shows how to use the following methods:getName
 
public class TestEC { 
 
    public static void main(String[] args) throws Exception {
        Provider p = new sun.security.ec.SunEC();
        System.out.println("Running tests with " + p.getName() +
            " provider...\n"); 
        long start = System.currentTimeMillis();
 
        /* 
         * The entry point used for each test is its instance method 
         * called main (not its static method called main). 
         */ 
        new TestECDH().main(p);
        new TestECDSA().main(p);
        new TestCurves().main(p);
        new TestKeyFactory().main(p);
        new TestECGenSpec().main(p);
        new ReadPKCS12().main(p);
        new ReadCertificates().main(p);

7
CodeRank
This code example shows how to use the following methods:getName
	private final int keysize, blocksize;
 
	public static final Provider AesCtrProvider = getAesCtrProvider();
	 
	public static String getProviderName() {
		return AesCtrProvider != null ? AesCtrProvider.getName() : null;
	} 
	 
	static private long benchmark(Cipher cipher, SecretKeySpec key, IvParameterSpec IV) throws GeneralSecurityException
	{ 
		long times = Long.MAX_VALUE;
		byte[] input = new byte[1024];
		byte[] output = new byte[input.length*32];
		cipher.init(Cipher.ENCRYPT_MODE, key, IV);
		// warm-up 
		for (int i = 0; i < 32; i++) {
			cipher.doFinal(input, 0, input.length, output, 0);
			System.arraycopy(output, 0, input, 0, input.length);
		} 
		for (int i = 0; i < 128; i++) {
6
CodeRank
This code example shows how to use the following methods:getName
 
public class TestEC { 
 
    public static void main(String[] args) throws Exception {
        Provider p = new sun.security.ec.SunEC();
        System.out.println("Running tests with " + p.getName() +
            " provider...\n"); 
        long start = System.currentTimeMillis();
 
        /* 
         * The entry point used for each test is its instance method 
         * called main (not its static method called main). 
         */ 
        new TestECDH().main(p);
        new TestECDSA().main(p);
        new TestCurves().main(p);
        new TestKeyFactory().main(p);
        new TestECGenSpec().main(p);
        new ReadPKCS12().main(p);
        new ReadCertificates().main(p);

6
CodeRank
This code example shows how to use the following methods:getName
    public static synchronized int insertProviderAt(Provider provider, int position) {
        int size = providers.size();
        if ((position < 1) || (position > size)) {
            position = size + 1;
        } 
        providers.add(position - 1, provider);
        providersNames.put(provider.getName(), provider);
        setNeedRefresh(); 
        return position;
    } 
 
    /** 
     * Removes the provider at the specified 1-based position. 
     */ 
    public static synchronized void removeProvider(int providerNumber) {
        Provider p = providers.remove(providerNumber - 1);
        providersNames.remove(p.getName());
        setNeedRefresh(); 
    } 
 
6
CodeRank
This code example shows how to use the following methods:getName
    public static int insertProviderAt(Provider provider, int position) {
        int size = providers.size();
        if ((position < 1) || (position > size)) {
            position = size + 1;
        } 
        providers.add(position - 1, provider);
        providersNames.put(provider.getName(), provider);
        setNeedRefresh(); 
        return position;
    } 
 
    /** 
     * Removes the provider 
     *  
     * @param providerNumber 
     */ 
    public static void removeProvider(int providerNumber) {
        Provider p = providers.remove(providerNumber - 1);
        providersNames.remove(p.getName());
        setNeedRefresh(); 
6
CodeRank
This code example shows how to use the following methods:getName
        } 
    } 
 
    public static void main0(String[] args) throws Exception {
        Provider p = new sun.security.ec.SunEC();
        System.out.println("Running tests with " + p.getName() +
            " provider...\n"); 
        long start = System.currentTimeMillis();
 
        /* 
         * The entry point used for each test is its instance method 
         * called main (not its static method called main). 
         */ 
        new TestECDH().main(p);
        new TestECDSA().main(p);
        new TestCurves().main(p);
        new TestKeyFactory().main(p);
        new TestECGenSpec().main(p);
        new ReadPKCS12().main(p);
        new ReadCertificates().main(p);

6
CodeRank
This code example shows how to use the following methods:getName
                   + " " + privateKey.getFormat()
                   + " private key."); 
        return privateKey;
    } finally { 
        // Dynamically deinstall the RSA provider  
        Security.removeProvider(provider.getName());
    } 
    } 
     
    /* ------------------------------------------------------------ */ 
    /** 
     * Show a usage message. 
     */ 
    static private void usage() 
    { 
        System.out.println(usageString);
        System.exit(23);
    } 
 
    /* ------------------------------------------------------------ */ 
6
CodeRank
This code example shows how to use the following methods:getName
 
public class TestEC { 
 
    public static void main(String[] args) throws Exception {
        Provider p = new sun.security.ec.SunEC();
        System.out.println("Running tests with " + p.getName() +
            " provider...\n"); 
        long start = System.currentTimeMillis();
 
        /* 
         * The entry point used for each test is its instance method 
         * called main (not its static method called main). 
         */ 
        new TestECDH().main(p);
        new TestECDSA().main(p);
        new TestCurves().main(p);
        new TestKeyFactory().main(p);
        new TestECGenSpec().main(p);
        new ReadPKCS12().main(p);
        new ReadCertificates().main(p);

6
CodeRank
This code example shows how to use the following methods:putAll, getProperty
        HashMap hm = new HashMap();
        hm.put("MessageDigest.SHA-1", "aaa.bbb.ccc.ddd");
        hm.put("Property 1", "value 1");
        hm.put("serviceName.algName attrName", "attrValue");
        hm.put("Alg.Alias.engineClassName.aliasName", "standardName");
        p.putAll(hm);
        if (!"value 1".equals(p.getProperty("Property 1").trim()) ||
                !"attrValue".equals(p.getProperty("serviceName.algName attrName").trim()) ||
                !"standardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
                !"aaa.bbb.ccc.ddd".equals(p.getProperty("MessageDigest.SHA-1").trim()) ) {
            fail("Incorrect property value");
        } 
    } 
 
    /* 
     * Class under test for Set entrySet() 
     */ 
    public final void testEntrySet() { 
        p.put("MessageDigest.SHA-256", "aaa.bbb.ccc.ddd");
 
5
CodeRank
This code example shows how to use the following methods:getName
   */ 
  public static final int addProvider(final Provider provider)
  { 
    log.entering(ProviderUtil.class.getName(), "addProvider", provider);
 
    Integer actualPosition = (Integer) AccessController.doPrivileged(new PrivilegedAction()
    { 
      public Object run()
      { 
        int result = Security.insertProviderAt(provider, 1);
        return Integer.valueOf(result);
      } 
    }); 
 
    int result = actualPosition.intValue();
    log.fine("Provider [" + provider.getName() + "] installed? " + (result != - 1));
 
    log.exiting(ProviderUtil.class.getName(), "addProvider", actualPosition);
    return result;
  } 
 
5
CodeRank

Related Java 8 Provider Questions & Answers:

See Code Examples for Java 8 Provider Methods: