Package java.security

Examples of java.security.GeneralSecurityException


          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

    exceptions.add(exception);
      }
      if (clientCredential == null) {
    if (exceptions == null) {
        clientCredentialException =
      new GeneralSecurityException("Credentials not found");
    } else if (exceptions.size() == 1) {
        clientCredentialException = (Exception) exceptions.get(0);
    } else {
        for (int i = exceptions.size(); --i >= 0; ) {
      Exception e = (Exception) exceptions.get(i);
      if (!(e instanceof SecurityException)) {
          clientCredentialException =
        new GeneralSecurityException(
            exceptions.toString());
          break;
      }
        }
        if (clientCredentialException == null) {
View Full Code Here

                if (keyManagers[idx] instanceof X509KeyManager) {
                    try {
                        keyManagers[idx] = new AliasedX509ExtendedKeyManager(tlsClientParameters.getCertAlias(),
                                                                             (X509KeyManager)keyManagers[idx]);
                    } catch (Exception e) {
                        throw new GeneralSecurityException(e);
                    }
                }
            }
        }
    }
View Full Code Here

    catch (GeneralSecurityException e1)
    {
      log
          .error("An exception occurred when securing the HTTP socket for SSL."
              + e1.getMessage());
      throw new GeneralSecurityException(
          "An exception occurred when securing the HTTP socket for SSL. "
              + e1.getMessage());
    }
    catch (IOException ex)
    {
View Full Code Here

                if (keyManagers[idx] instanceof X509KeyManager) {
                    try {
                        ret[idx] = new AliasedX509ExtendedKeyManager(tlsClientParameters.getCertAlias(),
                                                                             (X509KeyManager)keyManagers[idx]);
                    } catch (Exception e) {
                        throw new GeneralSecurityException(e);
                    }
                } else {
                    ret[idx] = keyManagers[idx];
                }
            }
View Full Code Here

                    && !(keyManagers[idx] instanceof AliasedX509ExtendedKeyManager)) {
                    try {
                        keyManagers[idx] = new AliasedX509ExtendedKeyManager(
                            tlsClientParameters.getCertAlias(), (X509KeyManager)keyManagers[idx]);
                    } catch (Exception e) {
                        throw new GeneralSecurityException(e);
                    }
                }
            }
        }
    }
View Full Code Here

    Key hmacKey = new SecretKeySpec(key, HMAC_TYPE);
    hmac.init(hmacKey);
    hmac.update(in);
    byte actual[] = hmac.doFinal();
    if (actual.length != expected.length) {
      throw new GeneralSecurityException("HMAC verification failure");
    }
    for (int i=0; i < actual.length; i++) {
      if (actual[i] != expected[i]) {
        throw new GeneralSecurityException("HMAC verification failure");       
      }
    }
  }
View Full Code Here

      throws GeneralSecurityException
   {
      Principal caller = context.getCallerPrincipal();
      String name = caller.getName();
      if( name.equals(callerName) == false )
         throw new GeneralSecurityException("CallerPrincipal.name("+name+") != "+callerName);

      validatePolicyContextSubject("enter", callerPrincipals);
      validateSecurityAssociationSubject("enter", callerPrincipals);

      InitialContext ctx = null;
      try
      {
         ctx = new InitialContext();
         StatelessSessionHome home = (StatelessSessionHome)
            ctx.lookup("java:comp/env/ejb/StatelessSession");
         StatelessSession bean = home.create();
         bean.echo("validateCallerContext");
         validatePolicyContextSubject("post stateless", callerPrincipals);
         validateSecurityAssociationSubject("post stateless", callerPrincipals);

         StatefulSessionHome home2 = (StatefulSessionHome)
            ctx.lookup("java:comp/env/ejb/StatefulSession");
         StatefulSession bean2 = home2.create("validateCallerContext");
         bean2.echo("validateCallerContext");
         validatePolicyContextSubject("post stateful", callerPrincipals);
         validateSecurityAssociationSubject("post stateful", callerPrincipals);

         EntityHome home3 = (EntityHome)
            ctx.lookup("java:comp/env/ejb/Entity");
         Entity bean3 = null;
         try
         {
            bean3 = home3.findByPrimaryKey("validateCallerContext");
         }
         catch(FinderException e)
         {
            bean3 = home3.create("validateCallerContext");           
         }
         bean3.echo("validateCallerContext");
      }
      catch(Exception e)
      {
         GeneralSecurityException ex = new GeneralSecurityException("Unexpected exception");
         ex.initCause(e);
         throw ex;
      }
      validatePolicyContextSubject("exit", callerPrincipals);
      validateSecurityAssociationSubject("exit", callerPrincipals);
   }
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.