Examples of WssCrypto


Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

    StringWriter writer = null;

    try
    {
      WSSecEncrypt wsEncrypt = new WSSecEncrypt();
      WssCrypto wssCrypto = getWssContainer().getCryptoByName( crypto );
      if( wssCrypto == null )
      {
        throw new Exception( "Missing crypto [" + crypto + "] for encryption entry" );
      }

      Crypto crypto = wssCrypto.getCrypto();

      wsEncrypt.setUserInfo( context.expand( getUsername() ) );

      // default is
      // http://ws.apache.org/wss4j/apidocs/org/apache/ws/security/WSConstants.html#ISSUER_SERIAL
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

  {
    StringWriter writer = null;

    try
    {
      WssCrypto wssCrypto = getWssContainer().getCryptoByName( crypto );
      if( wssCrypto == null )
      {
        throw new Exception( "Missing crypto [" + crypto + "] for signature entry" );
      }

      WSSecSignature wssSign = new WSSecSignature();
      wssSign.setUserInfo( context.expand( getUsername() ), context.expand( getPassword() ) );

      // default is
      // http://ws.apache.org/wss4j/apidocs/org/apache/ws/security/WSConstants.html#ISSUER_SERIAL
      if( keyIdentifierType != 0 )
        wssSign.setKeyIdentifierType( keyIdentifierType );

      if( StringUtils.hasContent( signatureAlgorithm ) && !signatureAlgorithm.equals( DEFAULT_OPTION ) )
        wssSign.setSignatureAlgorithm( signatureAlgorithm );

      if( StringUtils.hasContent( signatureCanonicalization ) && !signatureCanonicalization.equals( DEFAULT_OPTION ) )
        wssSign.setSigCanonicalization( signatureCanonicalization );

      wssSign.setUseSingleCertificate( useSingleCert );

      /* ADDED: Set the digest algorithm to the selected one */
      wssSign.setDigestAlgo( digestAlgorithm );

      Vector<WSEncryptionPart> wsParts = createWSParts( parts );
      if( !wsParts.isEmpty() )
      {
        wssSign.setParts( wsParts );
      }

      writer = new StringWriter();
      XmlUtils.serialize( doc, writer );

      wssSign.build( doc, wssCrypto.getCrypto(), secHeader );
    }
    catch( Exception e )
    {
      SoapUI.logError( e );

View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

        }
      }

      // do request
      WsdlProject project = ( WsdlProject )ModelSupport.getModelItemProject( httpRequest );
      WssCrypto crypto = null;
      if( project != null && project.getWssContainer() != null )
      {
        crypto = project.getWssContainer().getCryptoByName(
            PropertyExpander.expandProperties( submitContext, httpRequest.getSslKeystore() ) );
      }

      if( crypto != null && WssCrypto.STATUS_OK.equals( crypto.getStatus() ) )
      {
        hostConfiguration.getParams().setParameter( SoapUIHostConfiguration.SOAPUI_SSL_CONFIG,
            crypto.getSource() + " " + crypto.getPassword() );
      }

      // dump file?
      httpMethod.setDumpFile( PathUtils.expandPath( httpRequest.getDumpFile(),
          ( AbstractWsdlModelItem<?> )httpRequest, submitContext ) );
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

                }
            }

            // do request
            WsdlProject project = (WsdlProject) ModelSupport.getModelItemProject(httpRequest);
            WssCrypto crypto = null;
            if (project != null && project.getWssContainer() != null) {
                crypto = project.getWssContainer().getCryptoByName(
                        PropertyExpander.expandProperties(submitContext, httpRequest.getSslKeystore()));
            }

            if (crypto != null && WssCrypto.STATUS_OK.equals(crypto.getStatus())) {
                httpMethod.getParams().setParameter(SoapUIHttpRoute.SOAPUI_SSL_CONFIG,
                        crypto.getSource() + " " + crypto.getPassword());
            }

            // dump file?
            httpMethod.setDumpFile(PathUtils.expandPath(httpRequest.getDumpFile(),
                    (AbstractWsdlModelItem<?>) httpRequest, submitContext));
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

    public void process(WSSecHeader secHeader, Document doc, PropertyExpansionContext context) {
        StringWriter writer = null;

        try {
            WssCrypto wssCrypto = getWssContainer().getCryptoByName(crypto);
            if (wssCrypto == null) {
                throw new Exception("Missing crypto [" + crypto + "] for signature entry");
            }

            WSSecSignature wssSign = new WSSecSignature();
            wssSign.setUserInfo(context.expand(getUsername()), context.expand(getPassword()));

            // default is
            // http://ws.apache.org/wss4j/apidocs/org/apache/ws/security/WSConstants.html#ISSUER_SERIAL
            if (keyIdentifierType != 0) {
                wssSign.setKeyIdentifierType(keyIdentifierType);
            }

            if (StringUtils.hasContent(signatureAlgorithm) && !signatureAlgorithm.equals(DEFAULT_OPTION)) {
                wssSign.setSignatureAlgorithm(signatureAlgorithm);
            }

            if (StringUtils.hasContent(signatureCanonicalization) && !signatureCanonicalization.equals(DEFAULT_OPTION)) {
                wssSign.setSigCanonicalization(signatureCanonicalization);
            }

            wssSign.setUseSingleCertificate(useSingleCert);

            if (StringUtils.hasContent(digestAlgorithm)) {
                wssSign.setDigestAlgo(digestAlgorithm);
            }

            Vector<WSEncryptionPart> wsParts = createWSParts(parts);
            if (!wsParts.isEmpty()) {
                wssSign.setParts(wsParts);
            }

            writer = new StringWriter();
            XmlUtils.serialize(doc, writer);

            wssSign.setCallbackLookup(new BinarySecurityTokenDOMCallbackLookup(doc, wssSign));
            wssSign.build(doc, wssCrypto.getCrypto(), secHeader);
        } catch (Exception e) {
            SoapUI.logError(e);

            if (writer != null && writer.getBuffer().length() > 0) {
                try {
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

    public void process(WSSecHeader secHeader, Document doc, PropertyExpansionContext context) {
        StringWriter writer = null;

        try {
            WssCrypto wssCrypto = getWssContainer().getCryptoByName(crypto);
            if (wssCrypto == null) {
                throw new Exception("Missing crypto [" + crypto + "] for encryption entry");
            }

            Crypto crypto = wssCrypto.getCrypto();

            WSSecEncrypt wsEncrypt = new WSSecEncrypt();
            WSSConfig wssConfig = WSSConfig.getNewInstance();
            wsEncrypt.setWsConfig(wssConfig);
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

                }
                AssertionWrapper assertion = createAssertion(context, samlParms, callbackHandler);
                wsSecSAMLToken.build(doc, assertion, secHeader);
            } else {
                WSSecSignatureSAML wsSecSignatureSAML = new WSSecSignatureSAML();
                WssCrypto wssCrypto = getWssContainer().getCryptoByName(crypto, true);
                String alias = context.expand(getUsername());

                if (wssCrypto == null) {
                    throw new RuntimeException("Missing keystore [" + crypto + "] for signature entry");
                } else if (Strings.isNullOrEmpty(alias)) {
                    throw new RuntimeException(" No alias was provided for the keystore '" + crypto + "'. Please check your SAML (Form) configurations");
                }

                if (samlVersion.equals(SAML_VERSION_1)) {
                    callbackHandler = new SAML1CallbackHandler(wssCrypto.getCrypto(), alias,
                            assertionType, confirmationMethod);
                } else if (samlVersion.equals(SAML_VERSION_2)) {
                    callbackHandler = new SAML2CallbackHandler(wssCrypto.getCrypto(), alias,
                            assertionType, confirmationMethod);
                } else {
                    throw new IllegalArgumentException(NOT_A_VALID_SAML_VERSION);
                }

                AssertionWrapper assertion = createAssertion(context, samlParms, callbackHandler);

                assertion.signAssertion(context.expand(getUsername()), context.expand(getPassword()),
                        wssCrypto.getCrypto(), false);

                wsSecSignatureSAML.setUserInfo(context.expand(getUsername()), context.expand(getPassword()));

                if (confirmationMethod.equals(SENDER_VOUCHES_CONFIRMATION_METHOD)) {
                    wsSecSignatureSAML.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);

                    wsSecSignatureSAML.build(doc, null, assertion, wssCrypto.getCrypto(), context.expand(getUsername()),
                            context.expand(getPassword()), secHeader);
                } else if (confirmationMethod.equals(HOLDER_OF_KEY_CONFIRMATION_METHOD)) {
                    wsSecSignatureSAML.setDigestAlgo(digestAlgorithm);

                    if (assertionType.equals(AUTHENTICATION_ASSERTION_TYPE)) {
                        wsSecSignatureSAML.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
                        wsSecSignatureSAML.setSignatureAlgorithm(signatureAlgorithm);
                    } else if (assertionType.equals(ATTRIBUTE_ASSERTION_TYPE)) {

                        wsSecSignatureSAML.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
                        wsSecSignatureSAML.setSignatureAlgorithm(signatureAlgorithm);

                        byte[] ephemeralKey = callbackHandler.getEphemeralKey();
                        wsSecSignatureSAML.setSecretKey(ephemeralKey);
                    }

                    wsSecSignatureSAML.build(doc, wssCrypto.getCrypto(), assertion, null, null, null, secHeader);
                }
            }

        } catch (Exception e) {
            SoapUI.logError(e);
View Full Code Here

Examples of com.eviware.soapui.impl.wsdl.support.wss.WssCrypto

            if (row == -1) {
                return;
            }

            CryptoTableModel tableModel = (CryptoTableModel) cryptoTable.getModel();
            WssCrypto crypto = tableModel.getCryptoAt(row);

            if (UISupport.confirm("Removes selected " + cryptoType + "?", "Remove " + cryptoType)) {
                wssContainer.removeCrypto(crypto);
            }
        }
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.