Creating nested messages in OpenPGP
I figured it out. All you have to do is to use Bouncy Castle Java library. All other libraries are absolute garbage.
None of the libraries have docs, but at least this one is not a binding to a thirty-year-old C code.