Package java.security

Examples of java.security.GeneralSecurityException


         Subject caller = caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
         if( contains(caller, callerPrincipals) == false )
         {
            String msg = ctx+", PolicyContext subject: "+caller
               +" does not contain expected principals: "+callerPrincipals;
            throw new GeneralSecurityException(msg);
         }
      }
      catch(PolicyContextException e)
      {
        
View Full Code Here


      Subject caller = SecurityAssociation.getSubject();
      if( contains(caller, callerPrincipals) == false )
      {
         String msg = ctx+", SecurityAssociation subject: "+caller
            +" does not contain expected principals: "+callerPrincipals;
         throw new GeneralSecurityException(msg);
      }
   }
View Full Code Here

      while( iter.hasNext() )
      {
         key = (SecretKey) iter.next();
      }
      if( key == null )
         throw new GeneralSecurityException("Failed to find SecretKey in Subject.PrivateCredentials");

      credentials = subject.getPrivateCredentials(SRPParameters.class);
      iter = credentials.iterator();
      SRPParameters params = null;
      while( iter.hasNext() )
      {
         params = (SRPParameters) iter.next();
      }
      if( params == null )
         throw new GeneralSecurityException("Failed to find SRPParameters in Subject.PrivateCredentials");

      encryptCipher = Cipher.getInstance(key.getAlgorithm());
      encryptCipher.init(Cipher.ENCRYPT_MODE, key);
      decryptCipher = Cipher.getInstance(key.getAlgorithm());
      decryptCipher.init(Cipher.DECRYPT_MODE, key);        
View Full Code Here

         key = (SecretKey) iter.next();
      }
      if( key == null )
      {
         System.out.println("Subject: "+subject);
         throw new GeneralSecurityException("Failed to find SecretKey in Subject.PrivateCredentials");
      }

      credentials = subject.getPrivateCredentials(SRPParameters.class);
      iter = credentials.iterator();
      SRPParameters params = null;
      while( iter.hasNext() )
      {
         params = (SRPParameters) iter.next();
      }
      if( params == null )
         throw new GeneralSecurityException("Failed to find SRPParameters in Subject.PrivateCredentials");

      encryptCipher = Cipher.getInstance(key.getAlgorithm());
      encryptCipher.init(Cipher.ENCRYPT_MODE, key);
      decryptCipher = Cipher.getInstance(key.getAlgorithm());
      decryptCipher.init(Cipher.DECRYPT_MODE, key);        
View Full Code Here

       this.revocationChecker.check(cert);

       int pathLength = cert.getBasicConstraints();
       if (pathLength < 0) {
           if (!isCertificateAllowed(cert)) {
               throw new GeneralSecurityException(
                   "Certificate subject does not match pattern " + this.regExSubjectDnPattern.pattern());
           }
           if (this.checkKeyUsage && !isValidKeyUsage(cert)) {
              throw new GeneralSecurityException("Certificate keyUsage constraint forbids SSL client authentication.");
           }
       } else {
           // Check pathLength for CA cert
           if (pathLength == Integer.MAX_VALUE && this.maxPathLengthAllowUnspecified != true) {
               throw new GeneralSecurityException("Unlimited certificate path length not allowed by configuration.");
           } else if (pathLength > this.maxPathLength && pathLength < Integer.MAX_VALUE) {
               throw new GeneralSecurityException(String.format(
                   "Certificate path length %s exceeds maximum value %s.", pathLength, this.maxPathLength));
           }
       }
   }
View Full Code Here

     * @throws GeneralSecurityException Thrown in all cases.
     *
     * @see org.jasig.cas.adaptors.x509.authentication.handler.support.RevocationPolicy#apply(java.lang.Object)
     */
    public void apply(final Void nothing) throws GeneralSecurityException {
        throw new GeneralSecurityException("Aborting since DenyRevocationPolicy is in effect.");
    }
View Full Code Here

          signCert.verify(signCert.getPublicKey());
          if (latestRevision && chain.length > 1) {
            list.add(new VerificationOK(signCert, this.getClass(), "Root certificate in final revision"));
          }
          if (list.size() == 0 && verifyRootCertificate) {
            throw new GeneralSecurityException();
          }
          else if (chain.length > 1)
            list.add(new VerificationOK(signCert, this.getClass(), "Root certificate passed without checking"));
        }
        catch(GeneralSecurityException e) {
View Full Code Here

      OCSPResp ocspResponse = new OCSPResp(PdfReader.getStreamBytes(stream));
      if (ocspResponse.getStatus() == 0)
        try {
          ocsps.add((BasicOCSPResp) ocspResponse.getResponseObject());
        } catch (OCSPException e) {
          throw new GeneralSecurityException(e);
        }
    }
    return ocsps;
  }
View Full Code Here

        byte[] tsToken;
        try {
          tsToken = tsa.getTimeStampToken(tsImprint);
        }
        catch(Exception e) {
          throw new GeneralSecurityException(e);
        }

        if (contentEstimated + 2 < tsToken.length)
            throw new IOException("Not enough space");
View Full Code Here

      oos.writeObject(s);
      oos.close();
      data = baos.toByteArray();
    }
    catch(final IOException ioe) {
      throw new GeneralSecurityException("Error attempting to serialize object: " + ioe.getMessage());
    }

    // encrypt
    final Cipher cipher = Cipher.getInstance(CIPHER_TRANSFORMATION);
    cipher.init(Cipher.ENCRYPT_MODE, getKey());
View Full Code Here

TOP

Related Classes of java.security.GeneralSecurityException

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.