Examples of StatusType


Examples of org.picketlink.identity.federation.ws.trust.StatusType

        // if the validate request was made on behalf of another identity, get the principal of that identity.
        if (request.getOnBehalfOf() != null) {
            Principal onBehalfOfPrincipal = WSTrustUtil.getOnBehalfOfPrincipal(request.getOnBehalfOf());
            context.setOnBehalfOfPrincipal(onBehalfOfPrincipal);
        }
        StatusType status = null;

        // validate the security token digital signature.
        if (this.configuration.signIssuedToken() && this.configuration.getSTSKeyPair() != null) {
            KeyPair keyPair = this.configuration.getSTSKeyPair();
            try {
                if (logger.isTraceEnabled()) {
                    try {
                        logger.trace("Going to validate signature for: " + DocumentUtil.getNodeAsString(securityToken));
                    } catch (Exception e) {
                    }
                }
                Document tokenDocument = DocumentUtil.createDocument();
                Node importedNode = tokenDocument.importNode(securityToken, true);
                tokenDocument.appendChild(importedNode);
                XMLSignatureUtil.propagateIDAttributeSetup(securityToken, tokenDocument.getDocumentElement());
                if (!XMLSignatureUtil.validate(tokenDocument, keyPair.getPublic())) {
                    status = new StatusType();
                    status.setCode(WSTrustConstants.STATUS_CODE_INVALID);
                    status.setReason("Validation failure: digital signature is invalid");
                }
            } catch (Exception e) {
                status = new StatusType();
                status.setCode(WSTrustConstants.STATUS_CODE_INVALID);
                status.setReason("Validation failure: unable to verify digital signature: " + e.getMessage());
            }
        } else {
            logger.stsSecurityTokenSignatureNotVerified();
        }
View Full Code Here

Examples of org.w3._2002._03.xkms_.StatusType

       

    } // storeKeyStore
 
  protected void displayStatus(KeyBindingType type) {
    StatusType status = type.getStatus();
    getPrintStream().println("  The certificate had the following status");
    getPrintStream().println("  Valid:");
    displayStatusReasons(status.getValidReason());
    getPrintStream().println("  Indeterminable:");
    displayStatusReasons(status.getIndeterminateReason());
    getPrintStream().println("  Invalid:");
    displayStatusReasons(status.getInvalidReason());
   
  }
View Full Code Here

Examples of org.w3._2002._03.xkms_.StatusType

     *
     * @param kRSSCall, regenerated certificate return all valid
     * @param cert
     */
    private StatusType getStatus(X509Certificate cert, boolean kRSSCall) {
        StatusType retval = xkmsFactory.createStatusType();
       
        if(kRSSCall){
          retval.setStatusValue(XKMSConstants.STATUSVALUE_VALID);
          retval.getValidReason().add(XKMSConstants.STATUSREASON_VALIDITYINTERVAL);
          retval.getValidReason().add(XKMSConstants.STATUSREASON_ISSUERTRUST);
          retval.getValidReason().add(XKMSConstants.STATUSREASON_SIGNATURE);
          retval.getValidReason().add(XKMSConstants.STATUSREASON_REVOCATIONSTATUS);
        }else{
          boolean allValid = true;
          boolean inValidSet = false;

          //Check validity
          try{
            cert.checkValidity( new Date());
            retval.getValidReason().add(XKMSConstants.STATUSREASON_VALIDITYINTERVAL);
          }catch(Exception e){
            retval.getInvalidReason().add(XKMSConstants.STATUSREASON_VALIDITYINTERVAL);
            allValid = false;
            inValidSet = true;
          }

          // Check Issuer Trust
          try{
            int caid = CertTools.getIssuerDN(cert).hashCode();
            CAInfo cAInfo = caAdminSession.getCAInfo(pubAdmin, caid);
            if(cAInfo != null){
              retval.getValidReason().add(XKMSConstants.STATUSREASON_ISSUERTRUST);

              // Check signature 
              try{
                if(CertTools.verify(cert, cAInfo.getCertificateChain())){
                  retval.getValidReason().add(XKMSConstants.STATUSREASON_SIGNATURE);
                }else{
                  retval.getInvalidReason().add(XKMSConstants.STATUSREASON_SIGNATURE);
                  allValid = false;
                  inValidSet = true;
                }
              }catch(Exception e){
                retval.getInvalidReason().add(XKMSConstants.STATUSREASON_SIGNATURE);
                allValid = false
                inValidSet = true;
              }
            }else{
              retval.getInvalidReason().add(XKMSConstants.STATUSREASON_ISSUERTRUST);
              retval.getIndeterminateReason().add(XKMSConstants.STATUSREASON_SIGNATURE);
              allValid = false;
              inValidSet = true;
            }

            // Check RevocationReason
            CertificateStatus status = certificateStoreSession.getStatus(CertTools.getIssuerDN(cert), CertTools.getSerialNumber(cert));
            if(status != CertificateStatus.NOT_AVAILABLE){
              if(status.revocationReason == RevokedCertInfo.NOT_REVOKED){
                retval.getValidReason().add(XKMSConstants.STATUSREASON_REVOCATIONSTATUS);         
              }else{
                retval.getInvalidReason().add(XKMSConstants.STATUSREASON_REVOCATIONSTATUS);
                allValid = false;
                inValidSet = true;
              }             
            }else{
              retval.getIndeterminateReason().add(XKMSConstants.STATUSREASON_REVOCATIONSTATUS);
              allValid = false;
            }

          } catch (ClassCastException e) {
            log.error(intres.getLocalizedMessage("xkms.errorcreatesession"),e);
            resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
            resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
          }
          if(allValid){
            retval.setStatusValue(XKMSConstants.STATUSVALUE_VALID);
          }else{
            if(inValidSet){
              retval.setStatusValue(XKMSConstants.STATUSVALUE_INVALID);
            }else{
              retval.setStatusValue(XKMSConstants.STATUSVALUE_INDETERMINATE);
            }
          }
        }
    return retval;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.