Package javax.crypto

Examples of javax.crypto.Cipher.wrap()


            if (keyWrapAlgo != null) {
                Cipher cipher = p == null ? Cipher
                        .getInstance(keyWrapAlgo) : Cipher.getInstance(
                        keyWrapAlgo, p);
                cipher.init(Cipher.WRAP_MODE, kek, srand);
                return new SecuredCEK(cipher.wrap(cek), keyWrapAlgo);
            }
            // fall back to the Encryption Only (EO) key encrypting method
            Cipher cipher;
            byte[] toBeEncryptedBytes = cek.getEncoded();
            String algo = kek.getAlgorithm();
View Full Code Here


                encryedData = new SealedObject(row, cipher);
               
                cixKey = new CIXKey();
                cipher = Cipher.getInstance("RSA");
                cipher.init(Cipher.WRAP_MODE, privateKey);
                getCixKey().wrappedKey = cipher.wrap(key);  
            } catch (Exception e) {
                e.printStackTrace();
            }           
       
    }
View Full Code Here

                    Cipher cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }
               
                file = new CixFile(cixFileStat, noEncryData, null, wrappedKey, sealedEncryData);
View Full Code Here

                Cipher cipher = Cipher.getInstance("DES");
                cipher.init(Cipher.ENCRYPT_MODE,key);
                encryedDatas = new SealedObject(datas, cipher);
                cipher = Cipher.getInstance("RSA");
                cipher.init(Cipher.WRAP_MODE, privateKey);
                this.wrappedKey = cipher.wrap(key);
            } catch (Exception e) {
                e.printStackTrace();
            }           
            return encryedDatas;
       
View Full Code Here

            Cipher cipher = Cipher.getInstance(algorithm, bcProvider);

            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 cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                file = new CixFile(cixFileStat, noEncryData, pubKey, wrappedKey, sealedEncryData);
View Full Code Here

                    Cipher cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                file = new CixFile(cixFileStat, noEncryData, pubKey, wrappedKey, sealedEncryData);
View Full Code Here

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

            if (oaepParameters == null) {
                c.init(Cipher.WRAP_MODE, this.key);
            } else {
                c.init(Cipher.WRAP_MODE, this.key, oaepParameters);
            }
            encryptedBytes = c.wrap(key);
        } catch (InvalidKeyException ike) {
            throw new XMLEncryptionException("empty", ike);
        } catch (IllegalBlockSizeException ibse) {
            throw new XMLEncryptionException("empty", ibse);
        } catch (InvalidAlgorithmParameterException e) {
View Full Code Here

            if (oaepParameters == null) {
                c.init(Cipher.WRAP_MODE, this.key);
            } else {
                c.init(Cipher.WRAP_MODE, this.key, oaepParameters);
            }
            encryptedBytes = c.wrap(key);
        } catch (InvalidKeyException ike) {
            throw new XMLEncryptionException("empty", ike);
        } catch (IllegalBlockSizeException ibse) {
            throw new XMLEncryptionException("empty", ibse);
        } catch (InvalidAlgorithmParameterException 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.