CMS javadoc and closing streams
The bcpkix javadoc can be improved.
To use the CMS parsers and generators responsibly, the application programmer needs the protocol around closing the supplied underlying input and output streams. This can be gleaned by trial and error or by burrowing through the source code but it would help to have it in the top-level javadoc.
For example, CMSAuthEnvelopedDataParser drains and closes its underlying input stream and returns an input stream drawing on in-memory plaintext data. CMSAuthEnvelopedDataStreamGenerator closes its underlying output stream when the returned output stream is closed.
Correction -- CMSAuthEnvelopedDataStreamGenerator does not close its underlying output stream.