@@ -187,14 +187,14 @@ fn _ssl_enum_certificates(store_name: PyStrRef, vm: &VirtualMachine) -> PyResult
187
187
( * ptr) . dwCertEncodingType
188
188
} ;
189
189
let enc_type = match enc_type {
190
- wincrypt:: X509_ASN_ENCODING => vm. ctx . new_ascii_literal ( ascii ! ( "x509_asn" ) ) ,
191
- wincrypt:: PKCS_7_ASN_ENCODING => vm. ctx . new_ascii_literal ( ascii ! ( "pkcs_7_asn" ) ) ,
192
- other => vm. ctx . new_int ( other) . into ( ) ,
190
+ wincrypt:: X509_ASN_ENCODING => vm. new_pyobj ( ascii ! ( "x509_asn" ) ) ,
191
+ wincrypt:: PKCS_7_ASN_ENCODING => vm. new_pyobj ( ascii ! ( "pkcs_7_asn" ) ) ,
192
+ other => vm. new_pyobj ( other) ,
193
193
} ;
194
194
let usage: PyObjectRef = match c. valid_uses ( ) ? {
195
195
ValidUses :: All => vm. ctx . new_bool ( true ) . into ( ) ,
196
196
ValidUses :: Oids ( oids) => {
197
- PyFrozenSet :: from_iter ( vm, oids. into_iter ( ) . map ( |oid| vm. ctx . new_utf8_str ( oid) ) )
197
+ PyFrozenSet :: from_iter ( vm, oids. into_iter ( ) . map ( |oid| vm. ctx . new_str ( oid) . into ( ) ) )
198
198
. unwrap ( )
199
199
. into_ref ( vm)
200
200
. into ( )
@@ -991,7 +991,7 @@ fn convert_openssl_error(vm: &VirtualMachine, err: ErrorStack) -> PyBaseExceptio
991
991
let reason = sys:: ERR_GET_REASON ( e. code ( ) ) ;
992
992
vm. new_exception (
993
993
cls,
994
- vec ! [ vm. ctx. new_int( reason) . into( ) , vm. ctx. new_utf8_str ( msg) ] ,
994
+ vec ! [ vm. ctx. new_int( reason) . into( ) , vm. ctx. new_str ( msg) . into ( ) ] ,
995
995
)
996
996
}
997
997
None => vm. new_exception_empty ( cls) ,
@@ -1073,7 +1073,7 @@ fn cert_to_py(vm: &VirtualMachine, cert: &X509Ref, binary: bool) -> PyResult {
1073
1073
. entries ( )
1074
1074
. map ( |entry| {
1075
1075
let txt = obj2txt ( entry. object ( ) , false ) . into_pyobject ( vm) ;
1076
- let data = vm. ctx . new_utf8_str ( entry. data ( ) . as_utf8 ( ) ?. to_owned ( ) ) ;
1076
+ let data = vm. ctx . new_str ( entry. data ( ) . as_utf8 ( ) ?. to_owned ( ) ) ;
1077
1077
Ok ( vm. new_tuple ( ( ( txt, data) , ) ) . into ( ) )
1078
1078
} )
1079
1079
. collect :: < Result < _ , _ > > ( )
@@ -1092,18 +1092,18 @@ fn cert_to_py(vm: &VirtualMachine, cert: &X509Ref, binary: bool) -> PyResult {
1092
1092
. map_err ( |e| convert_openssl_error ( vm, e) ) ?;
1093
1093
dict. set_item (
1094
1094
"serialNumber" ,
1095
- vm. ctx . new_utf8_str ( serial_num. to_owned ( ) ) ,
1095
+ vm. ctx . new_str ( serial_num. to_owned ( ) ) . into ( ) ,
1096
1096
vm,
1097
1097
) ?;
1098
1098
1099
1099
dict. set_item (
1100
1100
"notBefore" ,
1101
- vm. ctx . new_utf8_str ( cert. not_before ( ) . to_string ( ) ) ,
1101
+ vm. ctx . new_str ( cert. not_before ( ) . to_string ( ) ) . into ( ) ,
1102
1102
vm,
1103
1103
) ?;
1104
1104
dict. set_item (
1105
1105
"notAfter" ,
1106
- vm. ctx . new_utf8_str ( cert. not_after ( ) . to_string ( ) ) ,
1106
+ vm. ctx . new_str ( cert. not_after ( ) . to_string ( ) ) . into ( ) ,
1107
1107
vm,
1108
1108
) ?;
1109
1109
@@ -1209,11 +1209,11 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
1209
1209
"_test_decode_cert" => named_function!( ctx, _ssl, _test_decode_cert) ,
1210
1210
1211
1211
// Constants
1212
- "OPENSSL_VERSION" => ctx. new_utf8_str ( openssl:: version:: version( ) ) ,
1212
+ "OPENSSL_VERSION" => ctx. new_str ( openssl:: version:: version( ) ) ,
1213
1213
"OPENSSL_VERSION_NUMBER" => ctx. new_int( openssl:: version:: number( ) ) ,
1214
1214
"OPENSSL_VERSION_INFO" => parse_version_info( openssl:: version:: number( ) ) . into_pyobject( vm) ,
1215
1215
"_OPENSSL_API_VERSION" => parse_version_info( openssl_api_version) . into_pyobject( vm) ,
1216
- "_DEFAULT_CIPHERS" => ctx. new_utf8_str ( DEFAULT_CIPHER_STRING ) ,
1216
+ "_DEFAULT_CIPHERS" => ctx. new_str ( DEFAULT_CIPHER_STRING ) ,
1217
1217
// "PROTOCOL_SSLv2" => ctx.new_int(SslVersion::Ssl2 as u32), unsupported
1218
1218
// "PROTOCOL_SSLv3" => ctx.new_int(SslVersion::Ssl3 as u32),
1219
1219
"PROTOCOL_SSLv23" => ctx. new_int( SslVersion :: Tls as u32 ) ,
0 commit comments