Problem with Subject directory attributes

Nikola Milenic <[email protected]> Fri, 14 Jun 2019 23:52:19 +0200
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <CALkVvMbyV6bemE9U6FZnAgsUhM3U2_b+RjsaLr+t8LqhaaTFrQ@mail.gmail.com>
Hello everyone,

I am trying to use Bouncy Castle to work with X509 Certificates. So far I
have ran into quite a few problems, but have always managed to solve them
with the help of various tutorials and example codes. However, now I need
to add Subject directory attributes extension to the certificate, and I am
unable to find any example code, documentation, or other resource that
would help me understand how to do that. I am able to add common
extensions, such as key usage, but this one in particular is troublesome. I
have no idea how to instantiate SubjectDirectoryAttributes class or how to
create Attributes or the ASN1Sequence that it requires. I have date of
birth, place of birth, country of citizenship and gender stored in
variables as standard non-bouncycastle datatypes, and I need to put them
into a Subject directory attributes extension.  Any help would be greatly
appreciated.

Thanks in advance,
Nikola Milenić