'Crate p12 rust - Error [E0599]: no method name `decrypt_padded_vec`found for struct `Decryptor` - in docker build

my docker builds started failing today and I can't seem to figure out exactly how to fix it.

Compiling locally is still working. When I try to create a container of the project, I get this error:

error[E0599]: no method named `decrypt_padded_vec` found for struct `Decryptor` in the current scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/p12-0.6.2/src/lib.rs:660:9
    |
660 |     rc2.decrypt_padded_vec::<Pkcs7>(data).ok()
    |         ^^^^^^^^^^^^^^^^^^ method not found in `Decryptor<Rc2>`

error[E0599]: no method named `decrypt_padded_vec` found for struct `Decryptor` in the current scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/p12-0.6.2/src/lib.rs:700:10
    |
700 |     tdes.decrypt_padded_vec::<Pkcs7>(data).ok()
    |          ^^^^^^^^^^^^^^^^^^ method not found in `Decryptor<TdesEde3>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `p12` due to 2 previous errors

One thing I noticed is that the crate p12 is being built with 0.6.2 and my local Cargo.lock uses 0.6.0, could this be the problem?

This is my Cargo.toml:

[dependencies]
actix="0.12.0"
actix-rt="2.6.0"
futures-util = "0.3.21"
tokio-tungstenite = {version = "0.16.1", features=["native-tls"]}
tokio = {version = "1.16.1"}
tokio-rustls = "0.22.0"
url = "2.2.2"
serde = {version="1.0", features=["serde_derive", "derive"]}
serde_json = "1.0.78"
log = "0.4.14"
dashmap = "5.0.0"
lapin = { version = "2.0.1", features=["rustls"] }
log4rs = "1.0.0"
dotenv = "0.15.0"
rustls = {version="0.19.1", features=["dangerous_configuration"]}
reqwest = "0.11.9"
clap = { version = "3.0.14", features = ["derive"] }

[dependencies.uuid]
features = ["v4", "serde", "v5"]
version = "0.8.2"

[dependencies.sqlx]
default_features = false
features = ["postgres", "macros", "chrono", "runtime-actix-rustls", "uuid", "offline"]
version = "0.5.9"

And this is my dockerfile:

FROM rust:1.57-slim as base
ENV USER=root
ENV SQLX_OFFLINE=true

WORKDIR /code
RUN cargo init
COPY sqlx-data.json /code/sqlx-data.json
COPY Cargo.toml /code/Cargo.toml
COPY .env /code/.env
COPY logging_config.yaml /code/logging_config.yaml
RUN apt-get update -y
RUN apt-get install apt-utils
RUN apt-get install -y pkg-config
RUN apt-get install -y libssl-dev

# Cargo fetch is super slow (sometimes)
RUN cargo fetch
# RUN git fetch --force --update-head-ok 'https://github.com/rust-lang/crates.io-index' 'refs/heads/master:refs/remotes/origin/master' 'HEAD:refs/remotes/origin/HEAD'
COPY src /code/src

FROM base as builder
RUN cargo build --release

FROM builder
COPY --from=builder /code/target/release/robot-websocket-client /usr/bin/robot-websocket-client

CMD ["/usr/bin/robot-websocket-client", "-r", "fakebot"]

For now, I think that the culprit is the different version of v0.6.2, but setting the specific version within the Cargo.toml file did not solve the problem.

Any insights would be appreciated. Please let me know if you need more information. Thank you,



Solution 1:[1]

You can dictate a specific dependency version via =X.Y.Z in cargo.toml. This seems to fix it:

p12 = "=0.6.0"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1