Extern crate crypto: error: source trait is private

Not sure if this is the right place, but there is very little support for the crypto crate: GitHub - DaGenix/rust-crypto: A (mostly) pure-Rust implementation of various cryptographic algorithms.

I tried to decrypt something. The important part is:

let mut out = [0; 4096];
let mut in_buf = buffer::RefReadBuffer::new(&key);
let mut out_buf = buffer::RefWriteBuffer::new(&mut out);
let mut dec = aes::cbc_decryptor(
dec.decrypt(&mut in_buf, &mut out_buf, true);

With this code i get this error:

src/main.rs:98:9: 98:53 error: source trait is private
src/main.rs:98         dec.decrypt(&mut in_buf, &mut out_buf, true);
error: aborting due to previous error

I don't have any clue why.

There is no published doc. I think this are the important parts:

pub fn cbc_decryptor<X: PaddingProcessor + Send + 'static>(key_size: KeySize, key: &[u8], iv: &[u8], padding: X) -> Box<Decryptor + 'static>
pub trait Decryptor {
    fn decrypt(&mut self, input: &mut RefReadBuffer, output: &mut RefWriteBuffer, eof: bool) -> Result<BufferResult, SymmetricCipherError>;
impl<T: BlockDecryptor, X: PaddingProcessor> Decryptor for CbcDecryptor<T, X>

Thanks for any help.

That's a pretty weird error message... You can fix it by saying

use crypto::symmetriccipher::Decryptor;

See also Misleading "error: source trait is private" when a trait is not imported · Issue #22050 · rust-lang/rust · GitHub

Thanks a lot. Now it works.