Package org.apache.xml.security.encryption

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


        XMLCipher kwCipher = XMLCipher.getInstance();
        kwCipher.init(XMLCipher.UNWRAP_MODE, keyWrappingKey);
        KeyInfo ki = encryptedData.getKeyInfo();
        EncryptedKey encryptedKey = ki.itemEncryptedKey(0);
        Key symmetricKey =
            kwCipher.decryptKey(
                encryptedKey, encryptedData.getEncryptionMethod().getAlgorithm()
            );

        cipher.init(XMLCipher.DECRYPT_MODE, symmetricKey);
        return cipher.doFinal(document, ee);
View Full Code Here


            throw new DecryptionException("Error when loading library native encrypted key representation", e);
        }

        Key key = null;
        try {
            key = xmlCipher.decryptKey(encKey, algorithm);
        } catch (XMLEncryptionException e) {
            log.error("Error decrypting encrypted key", e);
            throw new DecryptionException("Error decrypting encrypted key", e);
        }
        if (key == null) {
View Full Code Here

      if (encryptedData != null && encryptedKey != null)
      {
         String encAlgoURL = encryptedData.getEncryptionMethod().getAlgorithm();
         XMLCipher keyCipher =  XMLCipher.getInstance();
         keyCipher.init(XMLCipher.UNWRAP_MODE, privateKey);
         Key encryptionKey =  keyCipher.decryptKey( encryptedKey, encAlgoURL );
         cipher =  XMLCipher.getInstance()
         cipher.init(XMLCipher.DECRYPT_MODE, encryptionKey);
         decryptedDoc = cipher.doFinal(encryptedDoc, (Element)dataEL);
      }
      return decryptedDoc;
View Full Code Here

      EncryptedKey ek = encryptedData.getKeyInfo().itemEncryptedKey(0);

      if (ek != null) {
        XMLCipher keyCipher = XMLCipher.getInstance();
        keyCipher.init(XMLCipher.UNWRAP_MODE, kek);
        key = keyCipher.decryptKey(ek, encryptedData.getEncryptionMethod().getAlgorithm());
      }

      // Create a new cipher just to be paranoid
      XMLCipher cipher3 = XMLCipher.getInstance();
      cipher3.init(XMLCipher.DECRYPT_MODE, key);
View Full Code Here

      log.debug("Passed an Encrypted Key");
      try {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, _kek);
        EncryptedKey ek = cipher.loadEncryptedKey(element);
        _key = cipher.decryptKey(ek, _algorithm);
      }
      catch (Exception e) {}
      }
   
      return (_key != null);
View Full Code Here

        EncryptedKey encryptedKey = ki.itemEncryptedKey(0);

        XMLCipher cipher2 = XMLCipher.getInstance();
        cipher2.init(XMLCipher.UNWRAP_MODE, rsaKey);
        Key key =
                cipher2.decryptKey(
                        encryptedKey, encryptedData.getEncryptionMethod().getAlgorithm()
                );

        cipher.init(XMLCipher.DECRYPT_MODE, key);
        Document dd = cipher.doFinal(doc, ee);
View Full Code Here

        log.debug("Passed an Encrypted Key");
        try {
          XMLCipher cipher = XMLCipher.getInstance();
          cipher.init(XMLCipher.UNWRAP_MODE, _kek);
          EncryptedKey ek = cipher.loadEncryptedKey(element);
          key = (SecretKey) cipher.decryptKey(ek, _algorithm);
        }
        catch (Exception e) {}
        }
             
      return key;
View Full Code Here

      }
    }
    if (kek != null) {
      XMLCipher cipher = XMLCipher.getInstance();
      cipher.init(XMLCipher.UNWRAP_MODE, kek);
      key = cipher.decryptKey(encryptedKey,
                  encryptedData.
                  getEncryptionMethod().
                  getAlgorithm());
    }
   
View Full Code Here

      EncryptedKey ek = encryptedData.getKeyInfo().itemEncryptedKey(0);

      if (ek != null) {
        XMLCipher keyCipher = XMLCipher.getInstance();
        keyCipher.init(XMLCipher.UNWRAP_MODE, kek);
        key = keyCipher.decryptKey(ek, encryptedData.getEncryptionMethod().getAlgorithm());
      }

      // Create a new cipher just to be paranoid
      XMLCipher cipher3 = XMLCipher.getInstance();
      cipher3.init(XMLCipher.DECRYPT_MODE, key);
View Full Code Here

      }
    }
    if (kek != null) {
      XMLCipher cipher = XMLCipher.getInstance();
      cipher.init(XMLCipher.UNWRAP_MODE, kek);
      key = cipher.decryptKey(encryptedKey,
                  encryptedData.
                  getEncryptionMethod().
                  getAlgorithm());
    }
   
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.