Skip to content

Address BC 1.80 deprecation warnings #312

@bpholt

Description

@bpholt

BC 1.80 introduced two deprecation warnings that pop up in this project:

[warn] …/fs2-pgp/core/src/main/scala/com/dwolla/security/crypto/CryptoAlg.scala:179:51: method getKeyID in class PGPPublicKeyEncryptedData is deprecated
[warn]                   val recipientKeyId = Option(pbe.getKeyID).filterNot(_ == 0)
[warn]                                                   ^
[warn] …/fs2-pgp/core/src/main/scala/com/dwolla/security/crypto/CryptoAlg.scala:186:81: method getKeyID in class PGPPublicKeyEncryptedData is deprecated
[warn]                         Logger[F].trace(ex)(s"could not decrypt using key ${pbe.getKeyID}").as(None)
[warn]                                                                                 ^
[info] done compiling
[warn] two warnings found
[info] compiling 2 Scala sources to /Users/bholt/Developer/github/fs2-pgp/testkit/target/scala-2.13/classes ...
[warn] …/fs2-pgp/testkit/src/main/scala/com/dwolla/testutils/PgpArbitraries.scala:60:13: constructor JcaPGPKeyPair in class JcaPGPKeyPair is deprecated
[warn]             new JcaPGPKeyPair(PublicKeyAlgorithmTags.RSA_GENERAL, pair, now)
[warn]             ^
[info] done compiling
[warn] one warning found

We should migrate from using Long key IDs to using the new KeyIdentifier introduced in BC 1.80, or potentially migrate fully to using key fingerprints, which sounds like what BouncyCastle is planning to do long-term (see bcgit/bc-java #1752).

The change to JcaPGPKeyPair is less impactful. The constructor now takes a key version parameter, so we should be able to start setting that where it's available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions