Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate signature for CANONICAL_TEXT_DOCUMENT #60

Open
bjansen opened this issue Mar 19, 2021 · 1 comment
Open

Generate signature for CANONICAL_TEXT_DOCUMENT #60

bjansen opened this issue Mar 19, 2021 · 1 comment

Comments

@bjansen
Copy link

bjansen commented Mar 19, 2021

I have a use-case where I need to sign and encrypt a canonical text document rather than a binary document (see https://tools.ietf.org/html/rfc4880#section-5.2.1). This should replace \n with \r\n and set a particular flag, from what I understand.

It looks like the best way is to modify name.neuhalfen.projects.crypto.bouncycastle.openpgp.encrypting.PGPEncryptingStream#setup to make this statement configurable:

signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);

The PGPSignature.BINARY_DOCUMENT could be something that can be changed in BuildEncryptionOutputStreamAPI?

BouncyGPG
	.encryptToStream()
...
	.andSignWith(uid, PGPSignature.CANONICAL_TEXT_DOCUMENT)
	.binaryOutput()
	.andWriteTo(...)
@bjansen
Copy link
Author

bjansen commented Mar 19, 2021

@neuhalje I can provide a PR if you tell me if you'd rather have an overload for andSignWith(), or a new method like withSignatureType()

bjansen added a commit to bjansen/bouncy-gpg that referenced this issue May 4, 2021
bjansen added a commit to bjansen/bouncy-gpg that referenced this issue May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant