Package javax.crypto.spec

Examples of javax.crypto.spec.PSource$PSpecified


     */
    public void testGetMGFParameters() {
        String mdName = "SHA-1";
        String mgfName = "MGF1";
        AlgorithmParameterSpec mgfSpec = MGF1ParameterSpec.SHA1;
        PSource pSrc = PSource.PSpecified.DEFAULT;

        OAEPParameterSpec ps = new OAEPParameterSpec(mdName, mgfName,
                                                                mgfSpec, pSrc);
        assertTrue("The returned value does not equal to the "
                + "value specified in the constructor.",
View Full Code Here


     */
    public void testGetPSource() {
        String mdName = "SHA-1";
        String mgfName = "MGF1";
        AlgorithmParameterSpec mgfSpec = MGF1ParameterSpec.SHA1;
        PSource pSrc = PSource.PSpecified.DEFAULT;

        OAEPParameterSpec ps = new OAEPParameterSpec(mdName, mgfName,
                                                                mgfSpec, pSrc);
        assertTrue("The returned value does not equal to the "
                + "value specified in the constructor.",
View Full Code Here

     * PSource(String pSrcName) method testing. Tests that returned value is
     * equal to the value specified in the constructor.
     */
    public void testPSource() {
        try {
            new PSource(null);
            fail("NullPointerException should be thrown in the case of "
                    + "null pSrcName.");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

     * getAlgorithm() method testing. Tests that returned value is
     * equal to the value specified in the constructor.
     */
    public void testGetAlgorithm() {
        String pSrcName = "pSrcName";
        PSource ps = new PSource(pSrcName);
        assertTrue("The returned value is not equal to the value specified "
                + "in constructor", pSrcName.equals(ps.getAlgorithm()));
    }
View Full Code Here

        }
    }

    private static boolean comparePSource(OAEPParameterSpec s1,
        OAEPParameterSpec s2) {
        PSource src1 = s1.getPSource();
        PSource src2 = s2.getPSource();
        String alg1 = src1.getAlgorithm();
        String alg2 = src2.getAlgorithm();
        if (alg1.equals(alg2)) {
            // assumes they are PSource.PSpecified
            return Arrays.equals(((PSource.PSpecified) src1).getValue(),
                ((PSource.PSpecified) src2).getValue());
        } else {
View Full Code Here

        if (!(mgfSpec instanceof MGF1ParameterSpec)) {
            throw new InvalidParameterSpecException("Inappropriate mgf " +
                "parameters; non-null MGF1ParameterSpec only");
        }
        this.mgfSpec = (MGF1ParameterSpec) mgfSpec;
        PSource pSrc = spec.getPSource();
        if (pSrc.getAlgorithm().equals("PSpecified")) {
            p = ((PSource.PSpecified) pSrc).getValue();
        } else {
            throw new InvalidParameterSpecException("Unsupported pSource " +
                pSrc.getAlgorithm() + "; PSpecified only");
        }
    }
View Full Code Here

TOP

Related Classes of javax.crypto.spec.PSource$PSpecified

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.