Package java.security

Examples of java.security.KeyException


                            return null;
                        }
                    }
                );
            } catch (PrivilegedActionException pae) {
                throw new KeyException("ECKeyValue not supported",
                                        pae.getException());
            }
            Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
            try {
                ecPublicKey = (byte[])encodePoint.invoke(null, args);
            } catch (IllegalAccessException iae) {
                throw new KeyException(iae);
            } catch (InvocationTargetException ite) {
                throw new KeyException(ite);
            }
        }
View Full Code Here


        } else if (algorithm.equals("RSA")) {
            return new DOMKeyValue.RSA((RSAPublicKey) key);
        } else if (algorithm.equals("EC")) {
            return new DOMKeyValue.EC((ECPublicKey) key);
        } else {
            throw new KeyException("unsupported key algorithm: " + algorithm);
        }
    }
View Full Code Here

    /**
     * Test for <code>KeyException()</code> constructor Assertion: constructs
     * KeyException with no detail message
     */
    public void testKeyException01() {
        KeyException tE = new KeyException();
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    }
View Full Code Here

     * Test for <code>KeyException(String)</code> constructor Assertion:
     * constructs KeyException with detail message msg. Parameter
     * <code>msg</code> is not null.
     */
    public void testKeyException02() {
        KeyException tE;
        for (int i = 0; i < msgs.length; i++) {
            tE = new KeyException(msgs[i]);
            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                    .getMessage(), msgs[i]);
            assertNull("getCause() must return null", tE.getCause());
        }
    }
View Full Code Here

     * Test for <code>KeyException(String)</code> constructor Assertion:
     * constructs KeyException when <code>msg</code> is null
     */
    public void testKeyException03() {
        String msg = null;
        KeyException tE = new KeyException(msg);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    }
View Full Code Here

     * Test for <code>KeyException(Throwable)</code> constructor Assertion:
     * constructs KeyException when <code>cause</code> is null
     */
    public void testKeyException04() {
        Throwable cause = null;
        KeyException tE = new KeyException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    }
View Full Code Here

    /**
     * Test for <code>KeyException(Throwable)</code> constructor Assertion:
     * constructs KeyException when <code>cause</code> is not null
     */
    public void testKeyException05() {
        KeyException tE = new KeyException(tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
            assertTrue("getMessage() should contain ".concat(toS), (getM
                    .indexOf(toS) != -1));
        }
        assertNotNull("getCause() must not return null", tE.getCause());
        assertEquals("getCause() must return ".concat(tCause.toString()), tE
                .getCause(), tCause);
    }
View Full Code Here

     * Test for <code>KeyException(String, Throwable)</code> constructor
     * Assertion: constructs KeyException when <code>cause</code> is null
     * <code>msg</code> is null
     */
    public void testKeyException06() {
        KeyException tE = new KeyException(null, null);
        assertNull("getMessage() must return null", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    }
View Full Code Here

     * Test for <code>KeyException(String, Throwable)</code> constructor
     * Assertion: constructs KeyException when <code>cause</code> is null
     * <code>msg</code> is not null
     */
    public void testKeyException07() {
        KeyException tE;
        for (int i = 0; i < msgs.length; i++) {
            tE = new KeyException(msgs[i], null);
            assertEquals("getMessage() must return: ".concat(msgs[i]), tE
                    .getMessage(), msgs[i]);
            assertNull("getCause() must return null", tE.getCause());
        }
    }
View Full Code Here

     * Test for <code>KeyException(String, Throwable)</code> constructor
     * Assertion: constructs KeyException when <code>cause</code> is not null
     * <code>msg</code> is null
     */
    public void testKeyException08() {
        KeyException tE = new KeyException(null, tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
            assertTrue("getMessage() must should ".concat(toS), (getM
                    .indexOf(toS) != -1));
        }
        assertNotNull("getCause() must not return null", tE.getCause());
        assertEquals("getCause() must return ".concat(tCause.toString()), tE
                .getCause(), tCause);
    }
View Full Code Here

TOP

Related Classes of java.security.KeyException

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.