Lines Matching refs:ctx
16 //! let mut ctx = CipherCtx::new().unwrap();
17 //! ctx.encrypt_init(Some(cipher), Some(key), Some(iv)).unwrap();
20 //! ctx.cipher_update_vec(data, &mut ciphertext).unwrap();
21 //! ctx.cipher_final_vec(&mut ciphertext).unwrap();
42 //! let mut ctx = CipherCtx::new().unwrap();
43 //! ctx.decrypt_init(Some(cipher), Some(key), Some(iv)).unwrap();
46 //! ctx.cipher_update_vec(data, &mut plaintext).unwrap();
47 //! ctx.cipher_final_vec(&mut plaintext).unwrap();
523 /// Set ctx flags.
738 let mut ctx = CipherCtx::new().unwrap();
742 ctx.seal_init(
749 ctx.cipher_update_vec(secret, &mut encrypted).unwrap();
750 ctx.cipher_final_vec(&mut encrypted).unwrap();
753 ctx.open_init(Some(cipher), &encrypted_key, Some(&iv), Some(&private_key))
755 ctx.cipher_update_vec(&encrypted, &mut decrypted).unwrap();
756 ctx.cipher_final_vec(&mut decrypted).unwrap();
770 let mut ctx = CipherCtx::new().unwrap();
772 ctx.encrypt_init(Some(cipher), Some(&key), Some(&iv))
774 ctx.set_padding(false);
777 ctx.cipher_update_vec(&pt, &mut buf).unwrap();
778 ctx.cipher_final_vec(&mut buf).unwrap();
782 ctx.decrypt_init(Some(cipher), Some(&key), Some(&iv))
784 ctx.set_padding(false);
787 ctx.cipher_update_vec(&ct, &mut buf).unwrap();
788 ctx.cipher_final_vec(&mut buf).unwrap();
818 let mut ctx = CipherCtx::new().unwrap();
820 ctx.encrypt_init(Some(cipher), Some(&key), Some(&iv))
822 ctx.set_padding(false);
834 let outlen = ctx
842 let outlen = ctx
847 ctx.cipher_final_vec(&mut vec![0; 0]).unwrap();
851 ctx.encrypt_init(None, None, Some(&iv)).unwrap();
852 ctx.set_padding(false);
854 let outlen = ctx
859 let outlen = ctx
864 ctx.cipher_final(&mut [0u8; 0]).unwrap();
870 ctx.decrypt_init(Some(cipher), Some(&key), Some(&iv))
872 ctx.set_padding(false);
878 let outlen = ctx
883 let outlen = ctx
888 ctx.cipher_final_vec(&mut vec![0; 0]).unwrap();
893 ctx.decrypt_init(None, None, Some(&iv)).unwrap();
894 ctx.set_padding(false);
896 let outlen = ctx.cipher_update_inplace(&mut output[0..15], 15).unwrap();
899 let outlen = ctx.cipher_update_inplace(&mut output[15..], 17).unwrap();
902 ctx.cipher_final_vec(&mut vec![0; 0]).unwrap();
930 let mut ctx = CipherCtx::new().unwrap();
932 ctx.encrypt_init(Some(cipher), Some(&key), Some(&iv))
934 ctx.set_padding(false);
939 ctx.cipher_update(&vec![0; block_size + 1], Some(&mut vec![0; block_size - 1]))
951 let mut ctx = CipherCtx::new().unwrap();
953 ctx.set_flags(CipherCtxFlags::FLAG_WRAP_ALLOW);
954 ctx.encrypt_init(Some(cipher), Some(&key), iv.as_deref())
957 let count = ctx.cipher_update(&pt, Some(&mut computed)).unwrap();
958 let rest = ctx.cipher_final(&mut computed[count..]).unwrap();