Package org.apache.xml.security.encryption

Examples of org.apache.xml.security.encryption.XMLCipher.martial()


            throw new EncryptionException("Error encrypting element on key encryption", e);
        }

        EncryptedKey encryptedKey;
        try {
            Element encKeyElement = xmlCipher.martial(containingDocument, apacheEncryptedKey);
            encryptedKey = (EncryptedKey) encryptedKeyUnmarshaller.unmarshall(encKeyElement);
        } catch (UnmarshallingException e) {
            log.error("Error unmarshalling EncryptedKey element", e);
            throw new EncryptionException("Error unmarshalling EncryptedKey element");
        }
View Full Code Here


            throw new EncryptionException("Error encrypting XMLObject", e);
        }

        EncryptedData encryptedData;
        try {
            Element encDataElement = xmlCipher.martial(ownerDocument, apacheEncryptedData);
            encryptedData = (EncryptedData) encryptedDataUnmarshaller.unmarshall(encDataElement);
        } catch (UnmarshallingException e) {
            log.error("Error unmarshalling EncryptedData element", e);
            throw new EncryptionException("Error unmarshalling EncryptedData element", e);
        }
View Full Code Here

      cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);

      Document encryptedDoc =  cipher.doFinal(document, document.getDocumentElement());
      Element encryptedDocRootElement = encryptedDoc.getDocumentElement();
      // The EncryptedKey element is added
      Element encryptedKeyElement =  cipher.martial(document, ekey);

      // Outer ds:KeyInfo Element to hold the EncryptionKey
      Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
      sigElement.setAttributeNS(XMLNS, "xmlns:ds",  XMLSIG_NS);
      sigElement.appendChild(encryptedKeyElement);
View Full Code Here

  public void add(EncryptedKey encryptedKey)
    throws XMLEncryptionException {

    if (this._state == MODE_SIGN) {
      XMLCipher cipher = XMLCipher.getInstance();
      this._constructionElement.appendChild(cipher.martial(encryptedKey));
    }

  }

   /**
 
View Full Code Here

    throws XMLEncryptionException {
      if (encryptedKeys==null)
        encryptedKeys=new ArrayList();
      encryptedKeys.add(encryptedKey);
      XMLCipher cipher = XMLCipher.getInstance();
      this._constructionElement.appendChild(cipher.martial(encryptedKey));
  }

   /**
    * Method addUnknownElement
    *
 
View Full Code Here

    if (this._state == MODE_SIGN) {
      if (encryptedKeys==null)
        encryptedKeys=new ArrayList();
      encryptedKeys.add(encryptedKey);
      XMLCipher cipher = XMLCipher.getInstance();
      this._constructionElement.appendChild(cipher.martial(encryptedKey));
    }

  }

   /**
 
View Full Code Here

        XMLCipher dcipher = XMLCipher.getInstance(XMLCipher.AES_128);
        dcipher.init(XMLCipher.DECRYPT_MODE, key);
        Assert.assertEquals
            (encryptedData.getEncryptionMethod().getAlgorithm(),
             XMLCipher.AES_128);
        byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
        String after = new String(bytes, "UTF-8");
        Assert.assertEquals(before, after);

  // test with null type
        encryptedData = cipher.encryptData
View Full Code Here

        XMLCipher dcipher = XMLCipher.getInstance(XMLCipher.AES_128);
        dcipher.init(XMLCipher.DECRYPT_MODE, key);
        Assert.assertEquals
            (encryptedData.getEncryptionMethod().getAlgorithm(),
             XMLCipher.AES_128);
        byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
        String after = new String(bytes, "UTF-8");
        Assert.assertEquals(before, after);

  // test with null type
        encryptedData = cipher.encryptData
View Full Code Here

            throw new EncryptionException("Error encrypting element on key encryption", e);
        }

        EncryptedKey encryptedKey;
        try {
            Element encKeyElement = xmlCipher.martial(containingDocument, apacheEncryptedKey);
            encryptedKey = (EncryptedKey) encryptedKeyUnmarshaller.unmarshall(encKeyElement);
        } catch (UnmarshallingException e) {
            log.error("Error unmarshalling EncryptedKey element", e);
            throw new EncryptionException("Error unmarshalling EncryptedKey element");
        }
View Full Code Here

            throw new EncryptionException("Error encrypting XMLObject", e);
        }

        EncryptedData encryptedData;
        try {
            Element encDataElement = xmlCipher.martial(ownerDocument, apacheEncryptedData);
            encryptedData = (EncryptedData) encryptedDataUnmarshaller.unmarshall(encDataElement);
        } catch (UnmarshallingException e) {
            log.error("Error unmarshalling EncryptedData element", e);
            throw new EncryptionException("Error unmarshalling EncryptedData element", e);
        }
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.