Best code examples for Java 8 InvalidKeySpecException class (java.security.spec.InvalidKeySpecException)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 InvalidKeySpecException class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 InvalidKeySpecException examples from Open Source projects
This code example shows how to use the following methods:
                return new OpenSSLRSAPublicKey(key);
            } catch (Exception e) {
                throw new InvalidKeySpecException(e);
            } 
        } 
        throw new InvalidKeySpecException("Must use RSAPublicKeySpec or X509EncodedKeySpec; was "
                + keySpec.getClass().getName());
    } 
 
    @Override 
    protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException {
        if (keySpec instanceof RSAPrivateCrtKeySpec) {
            RSAPrivateCrtKeySpec rsaKeySpec = (RSAPrivateCrtKeySpec) keySpec;
 
            return new OpenSSLRSAPrivateCrtKey(rsaKeySpec);
        } else if (keySpec instanceof RSAPrivateKeySpec) {
            RSAPrivateKeySpec rsaKeySpec = (RSAPrivateKeySpec) keySpec;
 
            return new OpenSSLRSAPrivateKey(rsaKeySpec);
        } else if (keySpec instanceof PKCS8EncodedKeySpec) {
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
                    primeQ == null ? null : primeQ.toByteArray(),
                    primeExponentP == null ? null : primeExponentP.toByteArray(),
                    primeExponentQ == null ? null : primeExponentQ.toByteArray(),
                    crtCoefficient == null ? null : crtCoefficient.toByteArray()));
        } catch (Exception e) {
            throw new InvalidKeySpecException(e);
        } 
    } 
 
    static OpenSSLKey getInstance(RSAPrivateCrtKey rsaPrivateKey) throws InvalidKeyException {
        BigInteger modulus = rsaPrivateKey.getModulus();
        BigInteger privateExponent = rsaPrivateKey.getPrivateExponent();
 
        if (modulus == null) {
            throw new InvalidKeyException("modulus == null");
        } else if (privateExponent == null) {
            throw new InvalidKeyException("privateExponent == null");
        } 
 
        try { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCause, getMessage
     * Test for <code>InvalidKeySpecException(Throwable)</code> constructor 
     * Assertion: constructs InvalidKeySpecException when <code>cause</code> 
     * is not null 
     */ 
    public void testInvalidKeySpecException05() { 
        InvalidKeySpecException tE = new InvalidKeySpecException(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);
    } 
 
    /** 
     * Test for <code>InvalidKeySpecException(String, Throwable)</code> 
     * constructor Assertion: constructs InvalidKeySpecException when 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCause, getMessage
     * Assertion: constructs InvalidKeySpecException when <code>msg</code> is 
     * null 
     */ 
    public void testInvalidKeySpecException03() { 
        String msg = null;
        InvalidKeySpecException tE = new InvalidKeySpecException(msg);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>InvalidKeySpecException(Throwable)</code> constructor 
     * Assertion: constructs InvalidKeySpecException when <code>cause</code> 
     * is null 
     */ 
    public void testInvalidKeySpecException04() { 
        Throwable cause = null;
        InvalidKeySpecException tE = new InvalidKeySpecException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getMessage
Related Java 8 InvalidKeySpecException Questions & Answers: