OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "bin/secure_socket.h" | 8 #include "bin/secure_socket.h" |
9 #include "bin/secure_socket_macos.h" | 9 #include "bin/secure_socket_macos.h" |
10 | 10 |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 } | 1040 } |
1041 | 1041 |
1042 CFRelease(cert_dict); | 1042 CFRelease(cert_dict); |
1043 CFRelease(key_array); | 1043 CFRelease(key_array); |
1044 return issuer_name; | 1044 return issuer_name; |
1045 } | 1045 } |
1046 | 1046 |
1047 | 1047 |
1048 void FUNCTION_NAME(X509_Subject)(Dart_NativeArguments args) { | 1048 void FUNCTION_NAME(X509_Subject)(Dart_NativeArguments args) { |
1049 SecCertificateRef certificate = GetX509Certificate(args); | 1049 SecCertificateRef certificate = GetX509Certificate(args); |
1050 char* subject_name = GetNameFromCert(certificate, | 1050 char* subject_name = GetNameFromCert( |
1051 kSecOIDX509V1SubjectName, | 1051 certificate, |
1052 kSecOIDCommonName); | 1052 kSecOIDX509V1SubjectName, |
| 1053 reinterpret_cast<CFStringRef>(kSecOIDCommonName)); |
1053 if (subject_name == NULL) { | 1054 if (subject_name == NULL) { |
1054 Dart_ThrowException(DartUtils::NewDartArgumentError( | 1055 Dart_ThrowException(DartUtils::NewDartArgumentError( |
1055 "X509.subject failed to find issuer's common name.")); | 1056 "X509.subject failed to find issuer's common name.")); |
1056 } else { | 1057 } else { |
1057 Dart_SetReturnValue(args, Dart_NewStringFromCString(subject_name)); | 1058 Dart_SetReturnValue(args, Dart_NewStringFromCString(subject_name)); |
1058 } | 1059 } |
1059 } | 1060 } |
1060 | 1061 |
1061 | 1062 |
1062 void FUNCTION_NAME(X509_Issuer)(Dart_NativeArguments args) { | 1063 void FUNCTION_NAME(X509_Issuer)(Dart_NativeArguments args) { |
1063 SecCertificateRef certificate = GetX509Certificate(args); | 1064 SecCertificateRef certificate = GetX509Certificate(args); |
1064 char* issuer_name = GetNameFromCert(certificate, | 1065 char* issuer_name = GetNameFromCert( |
1065 kSecOIDX509V1IssuerName, | 1066 certificate, |
1066 kSecOIDCommonName); | 1067 kSecOIDX509V1IssuerName, |
| 1068 reinterpret_cast<CFStringRef>(kSecOIDCommonName)); |
1067 if (issuer_name == NULL) { | 1069 if (issuer_name == NULL) { |
1068 Dart_ThrowException(DartUtils::NewDartArgumentError( | 1070 Dart_ThrowException(DartUtils::NewDartArgumentError( |
1069 "X509.issuer failed to find issuer's common name.")); | 1071 "X509.issuer failed to find issuer's common name.")); |
1070 } else { | 1072 } else { |
1071 Dart_SetReturnValue(args, Dart_NewStringFromCString(issuer_name)); | 1073 Dart_SetReturnValue(args, Dart_NewStringFromCString(issuer_name)); |
1072 } | 1074 } |
1073 } | 1075 } |
1074 | 1076 |
1075 | 1077 |
1076 // Returns the number of seconds since the epoch from 'field'. | 1078 // Returns the number of seconds since the epoch from 'field'. |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 } | 2067 } |
2066 } | 2068 } |
2067 *bytes_processed = static_cast<intptr_t>(bytes); | 2069 *bytes_processed = static_cast<intptr_t>(bytes); |
2068 return status; | 2070 return status; |
2069 } | 2071 } |
2070 | 2072 |
2071 } // namespace bin | 2073 } // namespace bin |
2072 } // namespace dart | 2074 } // namespace dart |
2073 | 2075 |
2074 #endif // defined(TARGET_OS_MACOS) | 2076 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |