def _encode_asn1_utf8_str(backend, string):
 s = backend._lib.ASN1_UTF8STRING_new()
 res = backend._lib.ASN1_STRING_set(s, string.encode('utf8'), len(string.encode('utf8')))
 backend.openssl_assert((res == 1))
 return s

def _encode_asn1_utf8_str ( backend , string ) : s = backend . _lib . ASN1_UTF8STRING_new ( ) res = backend . _lib . ASN1_STRING_set ( s , string . encode ( 'utf8' ) , len ( string . encode ( 'utf8' ) ) ) backend . openssl_assert ( ( res == 1 ) ) return s
create an asn1_utf8string from a python unicode string .