Package javax.crypto

Examples of javax.crypto.Cipher.wrap()


    try {
      // Should internally generate an IV
      // todo - allow user to set an IV
      c.init(Cipher.WRAP_MODE, _key);
      encryptedBytes = c.wrap(key);
    } catch (InvalidKeyException ike) {
      throw new XMLEncryptionException("empty", ike);
    } catch (IllegalBlockSizeException ibse) {
      throw new XMLEncryptionException("empty", ibse);
    }
View Full Code Here


    try {
      // Should internally generate an IV
      // todo - allow user to set an IV
      c.init(Cipher.WRAP_MODE, _key);
      encryptedBytes = c.wrap(key);
    } catch (InvalidKeyException ike) {
      throw new XMLEncryptionException("empty", ike);
    } catch (IllegalBlockSizeException ibse) {
      throw new XMLEncryptionException("empty", ibse);
    }
View Full Code Here

            Cipher cipher = Cipher.getInstance(algorithm, "BC");

            cipher.init(Cipher.WRAP_MODE, keyFact.generateSecret(pbeSpec), defParams);

            out = cipher.wrap(key);
        }
        catch (Exception e)
        {
            throw new IOException("exception encrypting data - " + e.toString());
        }
View Full Code Here

                "cipher blksize: " + blockSize + ", symm key: " + secretKey.toString()
            );
        }
       
        try {
            encryptedEphemeralKey = cipher.wrap(secretKey);
        } catch (IllegalStateException ex) {
            throw new WSSecurityException(
                WSSecurityException.FAILED_ENCRYPTION, null, null, ex
            );
        } catch (IllegalBlockSizeException ex) {
View Full Code Here

    try {
      Cipher keyCipher = Cipher.getInstance("RSA");
     
      keyCipher.init(Cipher.WRAP_MODE, publicKey);

      byte []encKey = keyCipher.wrap(secretKey);

      return encKey;
    } catch (Exception e) {
      throw new RuntimeException(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.