how to set flags in X509_NAME_ENTRY in OpenSSL 1.1.1

Viktor Dukhovni openssl-users at
Wed Jun 19 01:11:39 UTC 2019

On Tue, Jun 18, 2019 at 09:51:31PM +0000, Blumenthal, Uri - 0553 - MITLL wrote:

> > We should perhaps provide getter/setter functions for the flags, or
> > perhaps even a specific function for indicating the value is a bitstring,
> > and how many bits it holds.  For now the ASN.1 string is not an opaque
> > structure.
> Considering how OpenSSL design evolved, I suspect that the time may come
> when this string would become opaque. Therefore, I suggest that
> getter/setter functions should be added.

Any thoughts about the interface?  Some flag bits look internal,
and not necessarily ideal for applications to modify directly, so
while these might do:

    long ASN1_STRING_get_flags(ASN1_STRING *);
    void ASN1_STRING_set_flags(ASN1_STRING *, long);

Perhaps all that's needed is:

    int ASN1_BIT_STRING_set_unused(ASN1_STRING *, int);

which sets the unused bit count, checking that the ASN1_STRING type
is V_ASN1_BIT_STRING and the count is in the range [0,7].


More information about the openssl-users mailing list