[Security] Fix some of the new availability attrs. (#4728)

This commit is contained in:
Manuel de la Pena 2018-08-29 23:33:09 +02:00 коммит произвёл GitHub
Родитель 9754d505ff
Коммит b1ebb89222
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 6 добавлений и 43 удалений

Просмотреть файл

@ -20,7 +20,7 @@ using CoreFoundation;
namespace Security {
[TV (12,0), Mac (10,14), iOS (12,0)]
[TV (12,0), Mac (10,14, onlyOn64: true), iOS (12,0)]
public class SecCertificate2 : NativeObject {
public SecCertificate2 (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -20,7 +20,7 @@ using CoreFoundation;
namespace Security {
[TV (12,0), Mac (10,14), iOS (12,0)]
[TV (12,0), Mac (10,14, onlyOn64: true), iOS (12,0)]
public class SecIdentity2 : NativeObject {
internal SecIdentity2 (IntPtr handle) : base (handle, false) {}
public SecIdentity2 (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -17,7 +17,7 @@ using sec_protocol_metadata_t=System.IntPtr;
using dispatch_queue_t=System.IntPtr;
namespace Security {
[TV (12,0), Mac (10,14), iOS (12,0)]
[TV (12,0), Mac (10,14, onlyOn64: true), iOS (12,0)]
public class SecProtocolMetadata : NativeObject {
internal SecProtocolMetadata (IntPtr handle) : base (handle, false) {}

Просмотреть файл

@ -19,13 +19,13 @@ using sec_identity_t=System.IntPtr;
namespace Security {
[TV (12,0), Mac (10,14, onlyOn64: true), iOS (12,0)]
public class SecProtocolOptions : NativeObject {
#if !COREBUILD
// This type is only ever surfaced in response to callbacks in TLS/Network and documented as read-only
// if this ever changes, make this public
internal SecProtocolOptions (IntPtr handle, bool owns) : base (handle, owns) {}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_local_identity (sec_protocol_options_t handle, sec_identity_t identity);
@ -36,37 +36,29 @@ namespace Security {
sec_protocol_options_set_local_identity (GetCheckedHandle (), identity.GetCheckedHandle ());
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_add_tls_ciphersuite (sec_protocol_options_t handle, SslCipherSuite cipherSuite);
public void AddTlsCipherSuite (SslCipherSuite cipherSuite) => sec_protocol_options_add_tls_ciphersuite (GetCheckedHandle (), cipherSuite);
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_add_tls_ciphersuite_group (sec_protocol_options_t handle, SslCipherSuiteGroup cipherSuiteGroup);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void AddTlsCipherSuiteGroup (SslCipherSuiteGroup cipherSuiteGroup) => sec_protocol_options_add_tls_ciphersuite_group (GetCheckedHandle (), cipherSuiteGroup);
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_min_version (sec_protocol_options_t handle, SslProtocol protocol);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsMinVersion (SslProtocol protocol) => sec_protocol_options_set_tls_min_version (GetCheckedHandle (), protocol);
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_max_version (sec_protocol_options_t handle, SslProtocol protocol);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsMaxVersion (SslProtocol protocol) => sec_protocol_options_set_tls_max_version (GetCheckedHandle (), protocol);
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_add_tls_application_protocol (sec_protocol_options_t handle, string applicationProtocol);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void AddTlsApplicationProtocol (string applicationProtocol)
{
if (applicationProtocol == null)
@ -74,11 +66,9 @@ namespace Security {
sec_protocol_options_add_tls_application_protocol (GetCheckedHandle (), applicationProtocol);
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_server_name (sec_protocol_options_t handle, string serverName);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsServerName (string serverName)
{
if (serverName == null)
@ -86,11 +76,9 @@ namespace Security {
sec_protocol_options_set_tls_server_name (GetCheckedHandle (), serverName);
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_diffie_hellman_parameters (IntPtr handle, IntPtr dispatchDataParameter);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsDiffieHellmanParameters (DispatchData parameters)
{
if (parameters == null)
@ -98,11 +86,9 @@ namespace Security {
sec_protocol_options_set_tls_diffie_hellman_parameters (GetCheckedHandle (), parameters.Handle);
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_add_pre_shared_key (IntPtr handle, IntPtr dispatchDataParameter);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void AddPreSharedKey (DispatchData parameters)
{
if (parameters == null)
@ -110,67 +96,49 @@ namespace Security {
sec_protocol_options_set_tls_diffie_hellman_parameters (GetCheckedHandle (), parameters.Handle);
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_tickets_enabled (IntPtr handle, byte ticketsEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsTicketsEnabled (bool ticketsEnabled) => sec_protocol_options_set_tls_tickets_enabled (GetCheckedHandle (), (byte)(ticketsEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_is_fallback_attempt (IntPtr handle, byte isFallbackAttempt);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsIsFallbackAttempt (bool isFallbackAttempt) => sec_protocol_options_set_tls_is_fallback_attempt (GetCheckedHandle (), (byte)(isFallbackAttempt ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_resumption_enabled (IntPtr handle, byte resumptionEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsResumptionEnabled (bool resumptionEnabled) => sec_protocol_options_set_tls_resumption_enabled (GetCheckedHandle (), (byte)(resumptionEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_false_start_enabled (IntPtr handle, byte falseStartEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsFalseStartEnabled (bool falseStartEnabled) => sec_protocol_options_set_tls_false_start_enabled (GetCheckedHandle (), (byte)(falseStartEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_ocsp_enabled (IntPtr handle, byte ocspEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsOcspEnabled (bool ocspEnabled) => sec_protocol_options_set_tls_ocsp_enabled (GetCheckedHandle (), (byte)(ocspEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_sct_enabled (IntPtr handle, byte sctEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsSignCertificateTimestampEnabled (bool sctEnabled) => sec_protocol_options_set_tls_sct_enabled (GetCheckedHandle (), (byte)(sctEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_renegotiation_enabled (IntPtr handle, byte renegotiationEnabled);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetTlsRenegotiationEnabled (bool renegotiationEnabled) => sec_protocol_options_set_tls_renegotiation_enabled (GetCheckedHandle (), (byte)(renegotiationEnabled ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_peer_authentication_required (IntPtr handle, byte peerAuthenticationRequired);
[TV (12,0), Mac (10,14), iOS (12,0)]
public void SetPeerAuthenticationRequired (bool peerAuthenticationRequired) => sec_protocol_options_set_peer_authentication_required (GetCheckedHandle (), (byte)(peerAuthenticationRequired ? 1 : 0));
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_key_update_block (sec_protocol_options_t options, ref BlockLiteral key_update_block, dispatch_queue_t key_update_queue);
[TV (12,0), Mac (10,14), iOS (12,0)]
[BindingImpl (BindingImplOptions.Optimizable)]
public void SetKeyUpdateCallback (SecProtocolKeyUpdate keyUpdate, DispatchQueue keyUpdateQueue)
{
@ -187,11 +155,9 @@ namespace Security {
}
#if false
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_challenge_block(sec_protocol_options_t options, IntPtr challenge_block, dispatch_queue_t challenge_queue);
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_verify_block(sec_protocol_options_t options, IntPtr verify_block, dispatch_queue_t verify_block_queue);
#endif

Просмотреть файл

@ -20,12 +20,11 @@ using CoreFoundation;
namespace Security {
[TV (12,0), Mac (10,14), iOS (12,0)]
[TV (12,0), Mac (10,14, onlyOn64: true), iOS (12,0)]
public class SecTrust2 : NativeObject {
internal SecTrust2 (IntPtr handle) : base (handle, false) {}
public SecTrust2 (IntPtr handle, bool owns) : base (handle, owns) {}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr sec_trust_create (IntPtr sectrustHandle);
@ -37,11 +36,9 @@ namespace Security {
Handle = sec_trust_create (trust.Handle);
}
[TV (12,0), Mac (10,14), iOS (12,0)]
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr sec_trust_copy_ref (IntPtr handle);
[TV (12,0), Mac (10,14), iOS (12,0)]
public SecTrust Trust => new SecTrust (sec_trust_copy_ref (GetCheckedHandle ()), owns: true);
}
}