Examples of encryptKey()


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

        XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_128_KeyWrap);
        keygen = KeyGenerator.getInstance("Camellia");
        keygen.init(128);
        SecretKey keyWrappingKey = keygen.generateKey();
        cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
        EncryptedKey encryptedKey = cipher.encryptKey(document, key);
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
       
View Full Code Here

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

        XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_192_KeyWrap);
        keygen = KeyGenerator.getInstance("Camellia");
        keygen.init(192);
        SecretKey keyWrappingKey = keygen.generateKey();
        cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
        EncryptedKey encryptedKey = cipher.encryptKey(document, key);
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
       
View Full Code Here

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

        XMLCipher cipher = XMLCipher.getInstance(XMLCipher.CAMELLIA_256_KeyWrap);
        keygen = KeyGenerator.getInstance("Camellia");
        keygen.init(256);
        SecretKey keyWrappingKey = keygen.generateKey();
        cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
        EncryptedKey encryptedKey = cipher.encryptKey(document, key);
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
       
View Full Code Here

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

        XMLCipher cipher = XMLCipher.getInstance(XMLCipher.SEED_128_KeyWrap);
        keygen = KeyGenerator.getInstance("SEED");
        keygen.init(128);
        SecretKey keyWrappingKey = keygen.generateKey();
        cipher.init(XMLCipher.WRAP_MODE, keyWrappingKey);
        EncryptedKey encryptedKey = cipher.encryptKey(document, key);
       
        // Encrypt using DOM
        List<String> localNames = new ArrayList<String>();
        localNames.add("PaymentInfo");
       
View Full Code Here

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

            throw new EncryptionException("Error initializing cipher instance on key encryption", e);
        }

        org.apache.xml.security.encryption.EncryptedKey apacheEncryptedKey;
        try {
            apacheEncryptedKey = xmlCipher.encryptKey(containingDocument, targetKey);
            postProcessApacheEncryptedKey(apacheEncryptedKey, targetKey, encryptionKey,
                    encryptionAlgorithmURI, containingDocument);
        } catch (XMLEncryptionException e) {
            log.error("Error encrypting element on key encryption", e);
            throw new EncryptionException("Error encrypting element on key encryption", e);
View Full Code Here

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

     
      String keyWrapAlgo = getXMLEncryptionURLForKeyUnwrap(pubKeyAlg, keySize);
      keyCipher = XMLCipher.getInstance(keyWrapAlgo);
        
      keyCipher.init(XMLCipher.WRAP_MODE, keyUsedToEncryptSecretKey);
      return keyCipher.encryptKey(document, keyToBeEncrypted);
   }
   
   /**
    * Encrypt a document at the root (Use aes-128)
    * @param document
View Full Code Here

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

        if (wrappingCert != null) {
            XMLCipher newCipher = XMLCipher.getInstance(keyTransportAlgorithm);
            newCipher.init(XMLCipher.WRAP_MODE, wrappingCert.getPublicKey());

            EncryptedKey encryptedKey = newCipher.encryptKey(document, encryptingKey);
            // Create a KeyInfo for the EncryptedKey
            KeyInfo encryptedKeyKeyInfo = encryptedKey.getKeyInfo();
            if (encryptedKeyKeyInfo == null) {
                encryptedKeyKeyInfo = new KeyInfo(document);
                encryptedKeyKeyInfo.getElement().setAttributeNS(
View Full Code Here

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

        if (wrappingCert != null) {
            XMLCipher newCipher = XMLCipher.getInstance(keyTransportAlgorithm);
            newCipher.init(XMLCipher.WRAP_MODE, wrappingCert.getPublicKey());

            EncryptedKey encryptedKey = newCipher.encryptKey(document, encryptingKey);
            // Create a KeyInfo for the EncryptedKey
            KeyInfo encryptedKeyKeyInfo = encryptedKey.getKeyInfo();
            if (encryptedKeyKeyInfo == null) {
                encryptedKeyKeyInfo = new KeyInfo(document);
                encryptedKeyKeyInfo.getElement().setAttributeNS(
View Full Code Here

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

        RSAPrivateKey privKey = (RSAPrivateKey) keyFactory.generatePrivate(privKeySpec);

        // Encrypt the data encryption key with the key encryption key
        XMLCipher keyCipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5);
        keyCipher.init(XMLCipher.WRAP_MODE, pubKey);
        EncryptedKey encryptedKey = keyCipher.encryptKey(document, dataEncryptKey);
       
        String keyName = "testResolvePrivateKey";
        KeyInfo kekInfo = new KeyInfo(document);
        kekInfo.addKeyName(keyName);
        encryptedKey.setKeyInfo(kekInfo);
View Full Code Here

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

            throw new EncryptionException("Error initializing cipher instance on key encryption", e);
        }

        org.apache.xml.security.encryption.EncryptedKey apacheEncryptedKey;
        try {
            apacheEncryptedKey = xmlCipher.encryptKey(containingDocument, targetKey);
            postProcessApacheEncryptedKey(apacheEncryptedKey, targetKey, encryptionKey,
                    encryptionAlgorithmURI, containingDocument);
        } catch (XMLEncryptionException e) {
            log.error("Error encrypting element on key encryption", e);
            throw new EncryptionException("Error encrypting element on key encryption", 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.