Examples of decryptKey()


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

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

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

            String algorithmURI = encryptedKey.getEncryptionMethod().getAlgorithm();
            XMLCipher xmlCipher = XMLCipher.getInstance();
            xmlCipher.init(XMLCipher.UNWRAP_MODE, null);
            xmlCipher.setKEK(kek);
       
            return xmlCipher.decryptKey(encryptedKey, algorithmURI);
        } catch (Exception e) {
            throw new XWSSecurityException(e);
        }
       
    }
View Full Code Here

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

         throw new WSSecurityException("Could not determine encrypted key algorithm!");

      try
      {
         cipher.init(XMLCipher.UNWRAP_MODE, privateKey);
         this.secretKey = (SecretKey) cipher.decryptKey(key, alg);
      }
      catch (XMLSecurityException e)
      {
         throw new WSSecurityException("Could not parse encrypted key: " + e.getMessage(), e);
      }
View Full Code Here

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

        assertTrue(rsaCert.equals(cert));
       
        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

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

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

        return key;
View Full Code Here

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

            }
            try {
                XMLCipher cipher = XMLCipher.getInstance();
                cipher.init(XMLCipher.UNWRAP_MODE, kek);
                EncryptedKey ek = cipher.loadEncryptedKey(element);
                key = (SecretKey) cipher.decryptKey(ek, algorithm);
            } catch (XMLEncryptionException e) {
                if (log.isDebugEnabled()) {
                    log.debug(e);
                }
            }
View Full Code Here

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

            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

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

      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 (XMLEncryptionException e) {}
        }
             
        return key;
   }
View Full Code Here

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

        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

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

                    for (int i = 0; i < size; i++) {
                        cipher.registerInternalKeyResolver(internalKeyResolvers.get(i));
                    }
                }
                EncryptedKey ek = cipher.loadEncryptedKey(element);
                key = (SecretKey) cipher.decryptKey(ek, algorithm);
            } catch (XMLEncryptionException e) {
                if (log.isDebugEnabled()) {
                    log.debug(e.getMessage(), 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.