Package javax.crypto

Examples of javax.crypto.ExemptionMechanism


        Provider mProv = (new SpiEngUtils()).new MyProvider("MyExMechProvider",
                "Provider for ExemptionMechanism testing",
                srvExemptionMechanism.concat(".").concat(defaultAlg),
                ExemptionMechanismProviderClass);

        ExemptionMechanism em = new ExemptionMechanism(
                new MyExemptionMechanismSpi(), mProv, defaultAlg) {
        };

        Key key = new MyExemptionMechanismSpi().new tmpKey("Proba", new byte[0]);

        assertFalse(em.isCryptoAllowed(key));

        em.init(key);
        assertFalse(em.isCryptoAllowed(key));

        em.genExemptionBlob();
        assertTrue(em.isCryptoAllowed(key));

        Key key1 = new MyExemptionMechanismSpi().new tmpKey("Proba",
                new byte[] { 1 });
        assertFalse(em.isCryptoAllowed(key1));

        em.init(key1);
        assertFalse(em.isCryptoAllowed(key));
    }
View Full Code Here


        Provider mProv = (new SpiEngUtils()).new MyProvider("MyExMechProvider",
                "Provider for ExemptionMechanism testing",
                srvExemptionMechanism.concat(".").concat(defaultAlg),
                ExemptionMechanismProviderClass);

        ExemptionMechanism em = new ExemptionMechanism(
                new MyExemptionMechanismSpi(), mProv, defaultAlg) {
        };

        Key key = new MyExemptionMechanismSpi().new tmpKey("Proba", new byte[0]);

        em.init(key);
        // ExemptionMechanism doesn't check parameters
        // it is a responsibility of ExemptionMechanismSpi
        em.genExemptionBlob(null, 0);
        em.genExemptionBlob(new byte[0], 0);
        em.genExemptionBlob(new byte[10], -5);

    }
View Full Code Here

                fail("NoSuchAlgorithmException must be thrown (algorithm: "
                        .concat(invalidValues[i]).concat(")"));
            } catch (NoSuchAlgorithmException e) {
            }
        }
        ExemptionMechanism exMech;
        for (int i = 0; i < validValues.length; i++) {
            exMech = ExemptionMechanism.getInstance(validValues[i]);
            assertEquals("Incorrect algorithm", exMech.getName(),
                    validValues[i]);
            assertEquals("Incorrect provider", exMech.getProvider(), mProv);
            checkResult(exMech);
        }
    }
View Full Code Here

                            .concat(invalidValues[j]).concat(")"));
                } catch (NoSuchProviderException e) {
                }
            }
        }
        ExemptionMechanism exMech;
        for (int i = 0; i < validValues.length; i++) {
            exMech = ExemptionMechanism.getInstance(validValues[i], mProv
                    .getName());
            assertEquals("Incorrect algorithm", exMech.getName(),
                    validValues[i]);
            assertEquals("Incorrect provider", exMech.getProvider().getName(),
                    mProv.getName());
            checkResult(exMech);
        }
    }
View Full Code Here

                fail("IllegalArgumentException must be thrown when provider is null (algorithm: "
                        .concat(invalidValues[i]).concat(")"));
            } catch (IllegalArgumentException e) {
            }
        }
        ExemptionMechanism exMech;
        for (int i = 0; i < validValues.length; i++) {
            exMech = ExemptionMechanism.getInstance(validValues[i], mProv);
            assertEquals("Incorrect algorithm", exMech.getName(),
                    validValues[i]);
            assertEquals("Incorrect provider", exMech.getProvider(), mProv);
            checkResult(exMech);
        }
    }
View Full Code Here

TOP

Related Classes of javax.crypto.ExemptionMechanism

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.