neuhalje / bouncy-gpg

Make using Bouncy Castle with OpenPGP fun again!
https://neuhalje.github.io/bouncy-gpg/
Other
205 stars 58 forks source link

Added a builder method to sign/encrypt as a text document #61

Open bjansen opened 3 years ago

bjansen commented 3 years ago

60

bjansen commented 3 years ago

I'm not sure how to modify the builder without causing compilation errors in existing projects that are not interested in this new feature. I added a method to Build, but this means it could theoretically be called multiple times:

BouncyGPG
    .encryptToStream()
    .withConfig(...)
    .withStrongAlgorithms()
    .toRecipients(...)
    .andSignWith(...)
    .binaryOutput()
    .textMode()
    .textMode()
    .textMode()
    .textMode()
    .andWriteTo(...)

Also, I haven't added any unit tests yet.

bjansen commented 3 years ago

@neuhalje were you able to take a look at this PR by any chance?

neuhalje commented 3 years ago

Sorry, I completely missed that one!

To remove the "multiple calls possible " topic: Add a new interface that derives from Build and returns Build. Return that from the previous step.

The example projects are a good way to test building: just update their grade/Pom and run the shell script.

Could you also add some unit test?

My next weekends are already planned - I can do an in depth review in two weeks

bjansen commented 3 years ago

Thanks for the suggestions! I added a unit test which checks that encrypted data can be decrypted, but I'm not sure how to check the data is actually encoded as text literal packets. I guess I could use BouncyCastle directly, but I'm not proficient enough with this library.

bjansen commented 3 years ago

@neuhalje do you think you'll have some time in the near future to review this PR? Thanks