X509_NAME_get_text_by_OBJ function
X509_NAME_get_text_by_OBJ finds the first attribute with type |obj| in |name|. If found, it writes the value's UTF-8 representation to |buf|. followed by a NUL byte, and returns the number of bytes in the output, excluding the NUL byte. This is unlike OpenSSL which returns the raw ASN1_STRING data. The UTF-8 encoding of the |ASN1_STRING| may not contain a 0 codepoint.
This function writes at most |len| bytes, including the NUL byte. If |buf| is NULL, it writes nothing and returns the number of bytes in the output, excluding the NUL byte that would be required for the full UTF-8 output.
This function may return -1 if an error occurs for any reason, including the value not being a recognized string type, |len| being of insufficient size to hold the full UTF-8 encoding and NUL byte, memory allocation failures, an object with type |obj| not existing in |name|, or if the UTF-8 encoding of the string contains a zero byte.
Implementation
@meta.RecordUse()
@ffi.Native<
ffi.Int Function(
ffi.Pointer<X509_NAME>,
ffi.Pointer<ASN1_OBJECT>,
ffi.Pointer<ffi.Char>,
ffi.Int,
)
>(symbol: 'bssl_dart_X509_NAME_get_text_by_OBJ')
external int X509_NAME_get_text_by_OBJ(
ffi.Pointer<X509_NAME> name,
ffi.Pointer<ASN1_OBJECT> obj,
ffi.Pointer<ffi.Char> buf,
int len,
);