Package org.apache.rahas.impl.util

Examples of org.apache.rahas.impl.util.SignKeyHolder


                    assertion.getAttributeStatements().add(createAttributeStatement(data, config));
                }
            }

            // Create a SignKeyHolder to hold the crypto objects that are used to sign the assertion
            SignKeyHolder signKeyHolder = createSignKeyHolder(config, crypto);

            // Sign the assertion
            assertion = setSignature(assertion, signKeyHolder);

View Full Code Here


     * @return
     * @throws TrustException
     */
    private SignKeyHolder createSignKeyHolder(SAMLTokenIssuerConfig config, Crypto crypto) throws TrustException {

        SignKeyHolder signKeyHolder = new SignKeyHolder();

        try {
            X509Certificate[] issuerCerts = crypto
                    .getCertificates(config.issuerKeyAlias);

            String sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA;
            String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
            if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
                sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA;
            }
            java.security.Key issuerPK = crypto.getPrivateKey(
                    config.issuerKeyAlias, config.issuerKeyPassword);

            signKeyHolder.setIssuerCerts(issuerCerts);
            signKeyHolder.setIssuerPK((PrivateKey) issuerPK);
            signKeyHolder.setSignatureAlgorithm(sigAlgo);

        } catch (Exception e) {
            throw new TrustException("Error creating issuer signature");
        }

View Full Code Here

        AuthnStatement authStmt = createAuthnStatement(data);
        assertion.getAuthnStatements().add(authStmt);
      }

      // Create a SignKeyHolder to hold the crypto objects that are used to sign the assertion
      SignKeyHolder signKeyHolder = createSignKeyHolder(config, crypto);

      // Sign the assertion
      assertion = setSignature(assertion, signKeyHolder);

      OMElement rstrElem;
View Full Code Here

   * @throws TrustException
   */
  private SignKeyHolder createSignKeyHolder(SAMLTokenIssuerConfig config, Crypto crypto)
      throws TrustException {

    SignKeyHolder signKeyHolder = new SignKeyHolder();

    try {
      X509Certificate[] issuerCerts = crypto.getCertificates(config.issuerKeyAlias);

      String sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA;
      String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
      if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
        sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA;
      }
      java.security.Key issuerPK = crypto.getPrivateKey(config.issuerKeyAlias,
          config.issuerKeyPassword);

      signKeyHolder.setIssuerCerts(issuerCerts);
      signKeyHolder.setIssuerPK((PrivateKey) issuerPK);
      signKeyHolder.setSignatureAlgorithm(sigAlgo);

    } catch (Exception e) {
      throw new TrustException("Error creating issuer signature");
    }

View Full Code Here

                AuthnStatement authStmt = createAuthnStatement(data);
                assertion.getAuthnStatements().add(authStmt);
            }

            // Create a SignKeyHolder to hold the crypto objects that are used to sign the assertion
            SignKeyHolder signKeyHolder = createSignKeyHolder(config, crypto);

            // Sign the assertion
            assertion = setSignature(assertion, signKeyHolder);

View Full Code Here

     * @return
     * @throws TrustException
     */
    private SignKeyHolder createSignKeyHolder(SAMLTokenIssuerConfig config, Crypto crypto) throws TrustException {

        SignKeyHolder signKeyHolder = new SignKeyHolder();

        try {
            X509Certificate[] issuerCerts = crypto
                    .getCertificates(config.issuerKeyAlias);

            String sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA;
            String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
            if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
                sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA;
            }
            java.security.Key issuerPK = crypto.getPrivateKey(
                    config.issuerKeyAlias, config.issuerKeyPassword);

            signKeyHolder.setIssuerCerts(issuerCerts);
            signKeyHolder.setIssuerPK((PrivateKey) issuerPK);
            signKeyHolder.setSignatureAlgorithm(sigAlgo);

        } catch (Exception e) {
            throw new TrustException("Error creating issuer signature");
        }

View Full Code Here

                    assertion.getAttributeStatements().add(createAttributeStatement(data, config));
                }
            }

            // Create a SignKeyHolder to hold the crypto objects that are used to sign the assertion
            SignKeyHolder signKeyHolder = createSignKeyHolder(config, crypto);

            // Sign the assertion
            assertion = setSignature(assertion, signKeyHolder);

View Full Code Here

     * @return
     * @throws TrustException
     */
    private SignKeyHolder createSignKeyHolder(SAMLTokenIssuerConfig config, Crypto crypto) throws TrustException {

        SignKeyHolder signKeyHolder = new SignKeyHolder();

        try {
            X509Certificate[] issuerCerts = CommonUtil.getCertificatesByAlias(crypto,config.issuerKeyAlias);

            String sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA;
            String pubKeyAlgo = issuerCerts[0].getPublicKey().getAlgorithm();
            if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
                sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_DSA;
            }
            java.security.Key issuerPK = crypto.getPrivateKey(
                    config.issuerKeyAlias, config.issuerKeyPassword);

            signKeyHolder.setIssuerCerts(issuerCerts);
            signKeyHolder.setIssuerPK((PrivateKey) issuerPK);
            signKeyHolder.setSignatureAlgorithm(sigAlgo);

        } catch (Exception e) {
            throw new TrustException("Error creating issuer signature");
        }

View Full Code Here

TOP

Related Classes of org.apache.rahas.impl.util.SignKeyHolder

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.