Package org.jboss.identity.xmlsec.w3.xmlenc

Examples of org.jboss.identity.xmlsec.w3.xmlenc.ObjectFactory


           clazz = tcl.loadClass(keyManagerClassName);
           this.keyManager = (TrustKeyManager) clazz.newInstance();
           keyManager.setAuthProperties(keyProvider.getAuth());
          
           Certificate cert = keyManager.getCertificate(signingAlias);
           KeyInfoType keyInfo = KeyUtil.getKeyInfo(cert);
          
           //TODO: Assume just signing key for now
           KeyDescriptorType keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
                 null, 0, true, false);
          
View Full Code Here


    * Create a KeyInfoType
    * @return
    */
   public static KeyInfoType createKeyInfo(String id)
   {
      KeyInfoType keyInfo = oFact.createKeyInfoType();
   
      keyInfo.setId(id);
      return keyInfo;
   }
View Full Code Here

         clazz = tcl.loadClass(keyManagerClassName);
         this.keyManager = (TrustKeyManager) clazz.newInstance();
         keyManager.setAuthProperties(keyProvider.getAuth());

         Certificate cert = keyManager.getCertificate(signingAlias);
         KeyInfoType keyInfo = KeyUtil.getKeyInfo(cert);

         //TODO: Assume just signing key for now
         KeyDescriptorType keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
               null, 0, true, false);
View Full Code Here

    * @throws WSTrustException if an error occurs while creating the {@code KeyInfoType} object.
    */
   public static KeyInfoType createKeyInfo(byte[] secret, PublicKey encryptionKey, URI keyWrapAlgo)
         throws WSTrustException
   {
      KeyInfoType keyInfo = null;

      // if a public key has been specified, encrypt the secret using the public key.
      if (encryptionKey != null)
      {
         try
         {
            Document document = DocumentUtil.createDocument();
            // TODO: XMLEncryptionUtil should allow for the specification of the key wrap algorithm.
            EncryptedKey key = XMLEncryptionUtil.encryptKey(document, new SecretKeySpec(secret, "AES"), encryptionKey,
                  secret.length);
            Element encryptedKeyElement = XMLCipher.getInstance().martial(key);
            keyInfo = new KeyInfoType();
            keyInfo.getContent().add(encryptedKeyElement);
         }
         catch (Exception e)
         {
            throw new WSTrustException("Error creating KeyInfoType", e);
         }
View Full Code Here

    * @return the constructed {@code KeyInfoType} object.
    * @throws WSTrustException if an error occurs while creating the {@code KeyInfoType}.
    */
   public static KeyInfoType createKeyInfo(Certificate certificate) throws WSTrustException
   {
      KeyInfoType keyInfo = null;
      try
      {
         // TODO: check if we need to store the certificate using a base64 format.
         byte[] encodedCert = certificate.getEncoded();

         // first create a X509DataType that contains the encoded certificate.
         org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory factory = new org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory();
         X509DataType dataType = factory.createX509DataType();
         dataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(
               factory.createX509DataTypeX509Certificate(encodedCert));

         // set the X509DataType in the KeyInfoType.
         keyInfo = new KeyInfoType();
         keyInfo.getContent().add(factory.createX509Data(dataType));
      }
      catch (Exception e)
      {
         throw new WSTrustException("Error creating KeyInfoType", e);
      }
View Full Code Here

         clazz = tcl.loadClass(keyManagerClassName);
         this.keyManager = (TrustKeyManager) clazz.newInstance();
         keyManager.setAuthProperties(keyProvider.getAuth());

         Certificate cert = keyManager.getCertificate(signingAlias);
         KeyInfoType keyInfo = KeyUtil.getKeyInfo(cert);

         //TODO: Assume just signing key for now
         KeyDescriptorType keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
               null, 0, true, false);
View Full Code Here

         // TODO: check if we need to store the certificate using a base64 format.
         byte[] encodedCert = certificate.getEncoded();

         // first create a X509DataType that contains the encoded certificate.
         org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory factory = new org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory();
         X509DataType dataType = factory.createX509DataType();
         dataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(
               factory.createX509DataTypeX509Certificate(encodedCert));

         // set the X509DataType in the KeyInfoType.
         keyInfo = new KeyInfoType();
         keyInfo.getContent().add(factory.createX509Data(dataType));
View Full Code Here

     
      KeyDescriptorType keyDescriptor = getObjectFactory().createKeyDescriptorType();
     
      if(algorithm != null && algorithm.length() > 0)
      {
         EncryptionMethodType encryptionMethod = new EncryptionMethodType();
         encryptionMethod.setAlgorithm(algorithm);
        
         encryptionMethod.getContent().add(BigInteger.valueOf(keySize));
        
         keyDescriptor.getEncryptionMethod().add(encryptionMethod)
      }
     
      if(isSigningKey)
View Full Code Here

TOP

Related Classes of org.jboss.identity.xmlsec.w3.xmlenc.ObjectFactory

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.