Package com.sun.org.apache.xml.internal.security.encryption

Examples of com.sun.org.apache.xml.internal.security.encryption.XMLCipher


  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


    Element e =
      XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
                      EncryptionConstants._TAG_ENCRYPTEDKEY,i);

    if (e != null) {
      XMLCipher cipher = XMLCipher.getInstance();
      cipher.init(XMLCipher.UNWRAP_MODE, null);
      return cipher.loadEncryptedKey(e);
    }
    return null;
   }
View Full Code Here

                              EncryptionConstants._TAG_ENCRYPTEDKEY);

      if (isEncryptedKey) {
      if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "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

    public void add(EncryptedKey encryptedKey) throws XMLEncryptionException {
        if (encryptedKeys == null) {
            encryptedKeys = new ArrayList<EncryptedKey>();
        }
        encryptedKeys.add(encryptedKey);
        XMLCipher cipher = XMLCipher.getInstance();
        this.constructionElement.appendChild(cipher.martial(encryptedKey));
    }
View Full Code Here

        Element e =
            XMLUtils.selectXencNode(
                this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

        if (e != null) {
            XMLCipher cipher = XMLCipher.getInstance();
            cipher.init(XMLCipher.UNWRAP_MODE, null);
            return cipher.loadEncryptedKey(e);
        }
        return null;
    }
View Full Code Here

        if (isEncryptedKey) {
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "Passed an Encrypted Key");
            }
            try {
                XMLCipher cipher = XMLCipher.getInstance();
                cipher.init(XMLCipher.UNWRAP_MODE, kek);
                if (internalKeyResolvers != null) {
                    int size = internalKeyResolvers.size();
                    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.isLoggable(java.util.logging.Level.FINE)) {
                    log.log(java.util.logging.Level.FINE, e.getMessage(), e);
                }
            }
View Full Code Here

        public void add(EncryptedKey encryptedKey)
                throws XMLEncryptionException {
                        if (encryptedKeys==null)
                                encryptedKeys=new ArrayList();
                        encryptedKeys.add(encryptedKey);
                        XMLCipher cipher = XMLCipher.getInstance();
                        this._constructionElement.appendChild(cipher.martial(encryptedKey));
        }
View Full Code Here

                Element e =
                        XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
                                                                                  EncryptionConstants._TAG_ENCRYPTEDKEY,i);

                if (e != null) {
                        XMLCipher cipher = XMLCipher.getInstance();
                        cipher.init(XMLCipher.UNWRAP_MODE, null);
                        return cipher.loadEncryptedKey(e);
                }
                return null;
   }
View Full Code Here

   
   
    private Key getDecipheredOtherPartyEntropy(Object encryptedKey, Key privKey) throws XMLEncryptionException {
        if ( encryptedKey instanceof EncryptedKey ) {
            EncryptedKey encKey = (EncryptedKey)encryptedKey;
            XMLCipher cipher = XMLCipher.getInstance();
            cipher.setKEK(privKey);
            cipher.decryptKey(encKey);
            return null;
        } else {
            return null;
        }
    }
View Full Code Here

                                      EncryptionConstants._TAG_ENCRYPTEDKEY);

              if (isEncryptedKey) {
                          log.log(java.util.logging.Level.FINE, "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

TOP

Related Classes of com.sun.org.apache.xml.internal.security.encryption.XMLCipher

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.