Package java.security

Examples of java.security.ProviderException


        Long id = nextSubjectId++;
        SubjectId subjectId;
        try {
            subjectId = new SubjectId(id, hash(id));
        } catch (NoSuchAlgorithmException e) {
            throw new ProviderException("No such algorithm: " + algorithm + ".  This can be caused by a misconfigured java.ext.dirs, JAVA_HOME or JRE_HOME environment variable");
        } catch (InvalidKeyException e) {
            throw new ProviderException("Invalid key: " + key.toString());
        }
        IdentificationPrincipal principal = new IdentificationPrincipal(subjectId);
       
        if(!subject.isReadOnly()){
            subject.getPrincipals().add(principal);
View Full Code Here


        try {
            Mac mac = Mac.getInstance(algorithm);
            mac.init(key);
        } catch (NoSuchAlgorithmException e) {
            assert false : "Should never have reached here";
            throw new ProviderException("No such algorithm: " + algorithm + ".  This can be caused by a misconfigured java.ext.dirs, JAVA_HOME or JRE_HOME environment variable.");
        } catch (InvalidKeyException e) {
            assert false : "Should never have reached here";
            throw new ProviderException("Invalid key: " + key.toString());
        }
    }
View Full Code Here

        if ( numBytes <= 0 ) {
            throw new IllegalArgumentException(Messages.getString("security.195", numBytes)); //$NON-NLS-1$
        }

        if ( !serviceAvailable ) {
            throw new ProviderException(
                Messages.getString("security.197") ); //$NON-NLS-1$
        }

        byte[] myBytes = new byte[numBytes];

        if ( !getWindowsRandom(myBytes, numBytes) ) {

            // it is unexpected result
            throw new ProviderException(
                Messages.getString("security.198") ); //$NON-NLS-1$
        }

        return myBytes;
    }
View Full Code Here

      {
         sha = MessageDigest.getInstance("SHA");
      }
      catch(NoSuchAlgorithmException e)
      {
         throw new ProviderException("Failed to obtain SHA MessageDigest");
      }
      evenBytes = new ByteArrayOutputStream();
      oddBytes = new ByteArrayOutputStream();
      engineReset();
   }
View Full Code Here

      {
         sha = MessageDigest.getInstance("SHA");
      }
      catch(NoSuchAlgorithmException e)
      {
         throw new ProviderException("Failed to obtain SHA MessageDigest");
      }
      evenBytes = new ByteArrayOutputStream();
      oddBytes = new ByteArrayOutputStream();
      engineReset();
   }
View Full Code Here

            }
            if ( Security.getProvider(pName)==null ) {
                Security.addProvider( prov );
            }
            if ( Security.getProvider(pName)==null ) {
                throw new ProviderException("Not possible to install provider: "+pName);
            }
        } else {
          if (log.isDebugEnabled()) {
            log.debug("No provider passed to setProvider()");
          }
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

        if ( numBytes <= 0 ) {
            throw new IllegalArgumentException(Messages.getString("security.195", numBytes)); //$NON-NLS-1$
        }

        if ( !serviceAvailable ) {
            throw new ProviderException(
                Messages.getString("security.196")); //$NON-NLS-1$
        }

        return getLinuxRandomBits(numBytes);
    }
View Full Code Here

        Long id = nextSubjectId++;
        SubjectId subjectId;
        try {
            subjectId = new SubjectId(id, hash(id));
        } catch (NoSuchAlgorithmException e) {
            throw new ProviderException("No such algorithm: " + algorithm + ".  This can be caused by a misconfigured java.ext.dirs, JAVA_HOME or JRE_HOME environment variable");
        } catch (InvalidKeyException e) {
            throw new ProviderException("Invalid key: " + key.toString());
        }
        List<String> groups = Collections.emptyList();
        Context context = new Context(subjectId, acc, subject, principal);
        subjectIds.put(context.getId(), subject);
        subjectContexts.put(subject, context);
View Full Code Here

        Long id = nextSubjectId++;
        SubjectId subjectId;
        try {
            subjectId = new SubjectId(id, hash(id));
        } catch (NoSuchAlgorithmException e) {
            throw new ProviderException("No such algorithm: " + algorithm + ".  This can be caused by a misconfigured java.ext.dirs, JAVA_HOME or JRE_HOME environment variable");
        } catch (InvalidKeyException e) {
            throw new ProviderException("Invalid key: " + key.toString());
        }
        IdentificationPrincipal principal = new IdentificationPrincipal(subjectId);
       
        if(!subject.isReadOnly()){
            subject.getPrincipals().add(principal);
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.