Package java.security

Examples of java.security.ProviderException


            "New message",
            "Long message for Exception. Long message for Exception. Long message for Exception." };

    protected Object[] getData() {
        Exception cause = new Exception(msgs[1]);
        ProviderException dExc = new ProviderException(msgs[0], cause);
        String msg = null;
        Throwable th = null;
        return new Object[] { new ProviderException(), new ProviderException(msg),
                new ProviderException(msgs[1]),
                new ProviderException(new Throwable()), new ProviderException(th),
                new ProviderException(msgs[1], dExc) };
    }
View Full Code Here


            securityCurrent =
                (CurrentImpl)orb.resolve_initial_references("SecurityCurrent");
        }
        catch ( org.omg.CORBA.ORBPackage.InvalidName in )
        {
            throw new ProviderException("Unable to obtain Security Current.");
        }

        return securityCurrent.getSSLCredentials();
    }
View Full Code Here

            securityCurrent =
                (CurrentImpl)orb.resolve_initial_references("SecurityCurrent");
        }
        catch ( org.omg.CORBA.ORBPackage.InvalidName in )
        {
            throw new ProviderException("Unable to obtain Security Current.");
        }

        return securityCurrent.getSSLCredentials();
    }
View Full Code Here

        try {
            this.key = new DerValue(DerValue.tag_Integer,
                                    this.y.toByteArray()).toByteArray();
            this.encodedKey = getEncoded();
        } catch (IOException e) {
            throw new ProviderException("Cannot produce ASN.1 encoding", e);
        }
    }
View Full Code Here

        try {
            this.key = new DerValue(DerValue.tag_Integer,
                                    this.x.toByteArray()).toByteArray();
            this.encodedKey = getEncoded();
        } catch (IOException e) {
            throw new ProviderException("Cannot produce ASN.1 encoding", e);
        }
    }
View Full Code Here

        byte[] b = new byte[digestLength];
        try {
            engineDigest(b, 0, b.length);
        } catch (DigestException e) {
            throw (ProviderException)
                new ProviderException("Internal error").initCause(e);
        }
        return b;
    }
View Full Code Here

        }
        session = objSessions.poll();
        if (session != null) {
            return ensureValid(session);
        }
        throw new ProviderException("Could not obtain session");
    }
View Full Code Here

    }

    private Session openSession() throws PKCS11Exception {
        if ((maxSessions != Integer.MAX_VALUE) &&
                (totalSessionCount() >= maxSessions)) {
            throw new ProviderException("No more sessions available");
        }
        long id = token.p11.C_OpenSession
                    (token.provider.slotID, openSessionFlags, null, null);
        Session session = new Session(token, id);
        if (debug != null) {
View Full Code Here


                // the below case should not occur because /dev/random or /dev/urandom is a special file
                // hence, if it is happened there is some internal problem
                if ( bytesRead == -1 ) {
                    throw new ProviderException(
                        Messages.getString("security.193") ); //$NON-NLS-1$
                }

                total  += bytesRead;
                offset += bytesRead;

                if ( total >= numBytes ) {
                    break;
                }         
            }
        } catch (IOException e) {

            // actually there should be no IOException because device is a special file;
            // hence, there is either some internal problem or, for instance,
            // device was removed in runtime, or something else
            throw new ProviderException(
                Messages.getString("security.194"), e ); //$NON-NLS-1$
        }
        return bytes;
    }
View Full Code Here

        }

        // We have been unable to get a random device or fall back to the
        // native security module code - throw an exception.
        if ( !serviceAvailable ) {
            throw new ProviderException(
                Messages.getString("security.196")); //$NON-NLS-1$
        }

        byte[] randomBits;
        if (bis != null) {
            // Random devices exist
            randomBits = getUnixDeviceRandom(numBytes);
        } else {
            // No random devices exist, use the system random() call
            randomBits = new byte[numBytes];
            if (!getUnixSystemRandom(randomBits, numBytes)) {
                // Even the system call has failed, throw an exception
                throw new ProviderException(
                    Messages.getString("security.196") ); //$NON-NLS-1$
            }
        }

        return randomBits;
View Full Code Here

TOP

Related Classes of java.security.ProviderException

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.