You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
19
mcs/class/Mono.Btls.Interface/Makefile
Normal file
19
mcs/class/Mono.Btls.Interface/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
thisdir = class/Mono.Btls.Interface
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
LIBRARY = Mono.Btls.Interface.dll
|
||||
LIB_REFS = System Mono.Security
|
||||
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP
|
||||
|
||||
ifndef HAVE_BTLS
|
||||
NO_INSTALL = yes
|
||||
NO_SIGN_ASSEMBLY = yes
|
||||
NO_TEST = yes
|
||||
NO_BUILD = yes
|
||||
endif
|
||||
|
||||
include ../../build/library.make
|
||||
|
||||
$(the_lib): ../Mono.Security/Makefile
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
./Properties/AssemblyInfo.cs
|
||||
../../build/common/Consts.cs
|
||||
../../build/common/Locale.cs
|
||||
../../build/common/MonoTODOAttribute.cs
|
||||
|
||||
Mono.Btls.Interface/BtlsObject.cs
|
||||
Mono.Btls.Interface/BtlsProvider.cs
|
||||
Mono.Btls.Interface/BtlsX509.cs
|
||||
Mono.Btls.Interface/BtlsX509Chain.cs
|
||||
Mono.Btls.Interface/BtlsX509Error.cs
|
||||
Mono.Btls.Interface/BtlsX509Format.cs
|
||||
Mono.Btls.Interface/BtlsX509Lookup.cs
|
||||
Mono.Btls.Interface/BtlsX509Name.cs
|
||||
Mono.Btls.Interface/BtlsX509Purpose.cs
|
||||
Mono.Btls.Interface/BtlsX509Store.cs
|
||||
Mono.Btls.Interface/BtlsX509StoreCtx.cs
|
||||
Mono.Btls.Interface/BtlsX509StoreManager.cs
|
||||
Mono.Btls.Interface/BtlsX509StoreType.cs
|
||||
Mono.Btls.Interface/BtlsX509TrustKind.cs
|
||||
Mono.Btls.Interface/BtlsX509VerifyFlags.cs
|
||||
Mono.Btls.Interface/BtlsX509VerifyParam.cs
|
||||
Mono.Btls.Interface/VersionInfo.cs
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// BtlsObject.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public abstract class BtlsObject : IDisposable
|
||||
{
|
||||
MonoBtlsObject instance;
|
||||
|
||||
internal MonoBtlsObject Instance {
|
||||
get {
|
||||
if (!IsValid)
|
||||
throw new ObjectDisposedException (GetType ().Name);
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
internal BtlsObject (MonoBtlsObject instance)
|
||||
{
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public bool IsValid {
|
||||
get { return instance != null && instance.IsValid; }
|
||||
}
|
||||
|
||||
protected void Dispose (bool disposing)
|
||||
{
|
||||
if (disposing) {
|
||||
if (instance != null) {
|
||||
instance.Dispose ();
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
~BtlsObject ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// BtlsProvider.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using Mono.Security.Interface;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using MNS = Mono.Net.Security;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public static class BtlsProvider
|
||||
{
|
||||
public static bool IsSupported ()
|
||||
{
|
||||
return MNS.MonoTlsProviderFactory.IsBtlsSupported ();
|
||||
}
|
||||
|
||||
public static MonoTlsProvider GetProvider ()
|
||||
{
|
||||
return new MonoBtlsProvider ();
|
||||
}
|
||||
|
||||
public static BtlsX509 CreateNative (byte[] data, BtlsX509Format format)
|
||||
{
|
||||
var x509 = MonoBtlsX509.LoadFromData (data, (MonoBtlsX509Format)format);
|
||||
return new BtlsX509 (x509);
|
||||
}
|
||||
|
||||
public static X509Certificate CreateCertificate (byte[] data, BtlsX509Format format, bool disallowFallback = false)
|
||||
{
|
||||
return MonoBtlsProvider.CreateCertificate (data, (MonoBtlsX509Format)format, disallowFallback);
|
||||
}
|
||||
|
||||
public static X509Certificate2 CreateCertificate2 (byte[] data, BtlsX509Format format, bool disallowFallback = false)
|
||||
{
|
||||
return MonoBtlsProvider.CreateCertificate2 (data, (MonoBtlsX509Format)format, disallowFallback);
|
||||
}
|
||||
|
||||
public static X509Certificate2 CreateCertificate2 (byte[] data, string password, bool disallowFallback = false)
|
||||
{
|
||||
return MonoBtlsProvider.CreateCertificate2 (data, password, disallowFallback);
|
||||
}
|
||||
|
||||
public static BtlsX509Chain CreateNativeChain ()
|
||||
{
|
||||
return new BtlsX509Chain (new MonoBtlsX509Chain ());
|
||||
}
|
||||
|
||||
public static BtlsX509Store CreateNativeStore ()
|
||||
{
|
||||
return new BtlsX509Store (new MonoBtlsX509Store ());
|
||||
}
|
||||
|
||||
public static BtlsX509StoreCtx CreateNativeStoreCtx ()
|
||||
{
|
||||
return new BtlsX509StoreCtx (new MonoBtlsX509StoreCtx ());
|
||||
}
|
||||
|
||||
public static X509Chain CreateChain ()
|
||||
{
|
||||
return MonoBtlsProvider.CreateChain ();
|
||||
}
|
||||
|
||||
public static string GetSystemStoreLocation ()
|
||||
{
|
||||
return MonoBtlsProvider.GetSystemStoreLocation ();
|
||||
}
|
||||
|
||||
public static BtlsX509VerifyParam GetVerifyParam_SslClient ()
|
||||
{
|
||||
return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslClient ());
|
||||
}
|
||||
|
||||
public static BtlsX509VerifyParam GetVerifyParam_SslServer ()
|
||||
{
|
||||
return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslServer ());
|
||||
}
|
||||
|
||||
public static X509Chain GetManagedChain (BtlsX509Chain chain)
|
||||
{
|
||||
return MonoBtlsProvider.GetManagedChain (chain.Instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
132
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs
Normal file
132
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// BtlsX509.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509 : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509 Instance {
|
||||
get { return (MonoBtlsX509)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509 (MonoBtlsX509 x509)
|
||||
: base (x509)
|
||||
{
|
||||
}
|
||||
|
||||
public BtlsX509Name GetSubjectName ()
|
||||
{
|
||||
return new BtlsX509Name (Instance.GetSubjectName ());
|
||||
}
|
||||
|
||||
public BtlsX509Name GetIssuerName ()
|
||||
{
|
||||
return new BtlsX509Name (Instance.GetIssuerName ());
|
||||
}
|
||||
|
||||
public string GetSubjectNameString ()
|
||||
{
|
||||
return Instance.GetSubjectNameString ();
|
||||
}
|
||||
|
||||
public string GetIssuerNameString ()
|
||||
{
|
||||
return Instance.GetIssuerNameString ();
|
||||
}
|
||||
|
||||
public byte[] GetRawData (BtlsX509Format format)
|
||||
{
|
||||
return Instance.GetRawData ((MonoBtlsX509Format)format);
|
||||
}
|
||||
|
||||
public byte[] GetCertHash ()
|
||||
{
|
||||
return Instance.GetCertHash ();
|
||||
}
|
||||
|
||||
public DateTime GetNotBefore ()
|
||||
{
|
||||
return Instance.GetNotBefore ();
|
||||
}
|
||||
|
||||
public DateTime GetNotAfter ()
|
||||
{
|
||||
return Instance.GetNotAfter ();
|
||||
}
|
||||
|
||||
public byte[] GetPublicKeyData ()
|
||||
{
|
||||
return Instance.GetPublicKeyData ();
|
||||
}
|
||||
|
||||
public byte[] GetSerialNumber (bool mono_style)
|
||||
{
|
||||
return Instance.GetSerialNumber (mono_style);
|
||||
}
|
||||
|
||||
public int GetVersion ()
|
||||
{
|
||||
return Instance.GetVersion ();
|
||||
}
|
||||
|
||||
public Oid GetSignatureAlgorithm ()
|
||||
{
|
||||
return Instance.GetSignatureAlgorithm ();
|
||||
}
|
||||
|
||||
public AsnEncodedData GetPublicKeyAsn1 ()
|
||||
{
|
||||
return Instance.GetPublicKeyAsn1 ();
|
||||
}
|
||||
|
||||
public AsnEncodedData GetPublicKeyParameters ()
|
||||
{
|
||||
return Instance.GetPublicKeyParameters ();
|
||||
}
|
||||
|
||||
public long GetSubjectNameHash ()
|
||||
{
|
||||
using (var name = GetSubjectName ())
|
||||
return name.GetHash ();
|
||||
}
|
||||
|
||||
public void Print (Stream stream)
|
||||
{
|
||||
using (var bio = MonoBtlsBio.CreateMonoStream (stream))
|
||||
Instance.Print (bio);
|
||||
}
|
||||
|
||||
public void ExportAsPEM (Stream stream, bool includeHumanReadableForm)
|
||||
{
|
||||
using (var bio = MonoBtlsBio.CreateMonoStream (stream))
|
||||
Instance.ExportAsPEM (bio, includeHumanReadableForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// BtlsX509Chain.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509Chain : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509Chain Instance {
|
||||
get { return (MonoBtlsX509Chain)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509Chain (MonoBtlsX509Chain chain)
|
||||
: base (chain)
|
||||
{
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get { return Instance.Count; }
|
||||
}
|
||||
|
||||
public BtlsX509 this[int index] {
|
||||
get {
|
||||
var x509 = Instance.GetCertificate (index);
|
||||
return new BtlsX509 (x509.Copy ());
|
||||
}
|
||||
}
|
||||
|
||||
public void Add (BtlsX509 x509)
|
||||
{
|
||||
Instance.AddCertificate (x509.Instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// BtlsX509Error.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with NativeBoringX509Error
|
||||
public enum BtlsX509Error
|
||||
{
|
||||
OK = 0,
|
||||
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
|
||||
|
||||
UNABLE_TO_GET_ISSUER_CERT = 2,
|
||||
UNABLE_TO_GET_CRL = 3,
|
||||
UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4,
|
||||
UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5,
|
||||
UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6,
|
||||
CERT_SIGNATURE_FAILURE = 7,
|
||||
CRL_SIGNATURE_FAILURE = 8,
|
||||
CERT_NOT_YET_VALID = 9,
|
||||
CERT_HAS_EXPIRED = 10,
|
||||
CRL_NOT_YET_VALID = 11,
|
||||
CRL_HAS_EXPIRED = 12,
|
||||
ERROR_IN_CERT_NOT_BEFORE_FIELD = 13,
|
||||
ERROR_IN_CERT_NOT_AFTER_FIELD = 14,
|
||||
ERROR_IN_CRL_LAST_UPDATE_FIELD = 15,
|
||||
ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16,
|
||||
OUT_OF_MEM = 17,
|
||||
DEPTH_ZERO_SELF_SIGNED_CERT = 18,
|
||||
SELF_SIGNED_CERT_IN_CHAIN = 19,
|
||||
UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20,
|
||||
UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21,
|
||||
CERT_CHAIN_TOO_LONG = 22,
|
||||
CERT_REVOKED = 23,
|
||||
INVALID_CA = 24,
|
||||
PATH_LENGTH_EXCEEDED = 25,
|
||||
INVALID_PURPOSE = 26,
|
||||
CERT_UNTRUSTED = 27,
|
||||
CERT_REJECTED = 28,
|
||||
/* These are 'informational' when looking for issuer cert */
|
||||
SUBJECT_ISSUER_MISMATCH = 29,
|
||||
AKID_SKID_MISMATCH = 30,
|
||||
AKID_ISSUER_SERIAL_MISMATCH = 31,
|
||||
KEYUSAGE_NO_CERTSIGN = 32,
|
||||
|
||||
UNABLE_TO_GET_CRL_ISSUER = 33,
|
||||
UNHANDLED_CRITICAL_EXTENSION = 34,
|
||||
KEYUSAGE_NO_CRL_SIGN = 35,
|
||||
UNHANDLED_CRITICAL_CRL_EXTENSION = 36,
|
||||
INVALID_NON_CA = 37,
|
||||
PROXY_PATH_LENGTH_EXCEEDED = 38,
|
||||
KEYUSAGE_NO_DIGITAL_SIGNATURE = 39,
|
||||
PROXY_CERTIFICATES_NOT_ALLOWED = 40,
|
||||
|
||||
INVALID_EXTENSION = 41,
|
||||
INVALID_POLICY_EXTENSION = 42,
|
||||
NO_EXPLICIT_POLICY = 43,
|
||||
DIFFERENT_CRL_SCOPE = 44,
|
||||
UNSUPPORTED_EXTENSION_FEATURE = 45,
|
||||
|
||||
UNNESTED_RESOURCE = 46,
|
||||
|
||||
PERMITTED_VIOLATION = 47,
|
||||
EXCLUDED_VIOLATION = 48,
|
||||
SUBTREE_MINMAX = 49,
|
||||
UNSUPPORTED_CONSTRAINT_TYPE = 51,
|
||||
UNSUPPORTED_CONSTRAINT_SYNTAX = 52,
|
||||
UNSUPPORTED_NAME_SYNTAX = 53,
|
||||
CRL_PATH_VALIDATION_ERROR = 54,
|
||||
|
||||
/* Suite B mode algorithm violation */
|
||||
SUITE_B_INVALID_VERSION = 56,
|
||||
SUITE_B_INVALID_ALGORITHM = 57,
|
||||
SUITE_B_INVALID_CURVE = 58,
|
||||
SUITE_B_INVALID_SIGNATURE_ALGORITHM = 59,
|
||||
SUITE_B_LOS_NOT_ALLOWED = 60,
|
||||
SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 = 61,
|
||||
|
||||
/* Host, email and IP check errors */
|
||||
HOSTNAME_MISMATCH = 62,
|
||||
EMAIL_MISMATCH = 63,
|
||||
IP_ADDRESS_MISMATCH = 64,
|
||||
|
||||
/* The application is not happy */
|
||||
APPLICATION_VERIFICATION = 50
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// BtlsX509Format.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with NativeBoringX509Format
|
||||
public enum BtlsX509Format
|
||||
{
|
||||
DER = 1,
|
||||
PEM = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// BtlsX509Lookup.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509Lookup : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509Lookup Instance {
|
||||
get { return (MonoBtlsX509Lookup)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509Lookup (MonoBtlsX509Lookup lookup)
|
||||
: base (lookup)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize ()
|
||||
{
|
||||
Instance.Initialize ();
|
||||
}
|
||||
|
||||
public void Shutdown ()
|
||||
{
|
||||
Instance.Shutdown ();
|
||||
}
|
||||
|
||||
public BtlsX509 LookupBySubject (BtlsX509Name name)
|
||||
{
|
||||
var x509 = Instance.LookupBySubject (name.Instance);
|
||||
if (x509 == null)
|
||||
return null;
|
||||
|
||||
return new BtlsX509 (x509);
|
||||
}
|
||||
|
||||
public void LoadFile (string file, BtlsX509Format type)
|
||||
{
|
||||
Instance.LoadFile (file, (MonoBtlsX509FileType)type);
|
||||
}
|
||||
|
||||
public void AddDirectory (string dir, BtlsX509Format type)
|
||||
{
|
||||
Instance.AddDirectory (dir, (MonoBtlsX509FileType)type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// BtlsX509Name.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509Name : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509Name Instance {
|
||||
get { return (MonoBtlsX509Name)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509Name (MonoBtlsX509Name name)
|
||||
: base (name)
|
||||
{
|
||||
}
|
||||
|
||||
public string GetString ()
|
||||
{
|
||||
return Instance.GetString ();
|
||||
}
|
||||
|
||||
public byte[] GetRawData (bool use_canon_enc)
|
||||
{
|
||||
return Instance.GetRawData (use_canon_enc);
|
||||
}
|
||||
|
||||
public long GetHash ()
|
||||
{
|
||||
return Instance.GetHash ();
|
||||
}
|
||||
|
||||
public long GetHashOld ()
|
||||
{
|
||||
return Instance.GetHashOld ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// BtlsX509Purpose.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with NativeBoringX509Purpose
|
||||
public enum BtlsX509Purpose
|
||||
{
|
||||
SSL_CLIENT = 1,
|
||||
SSL_SERVER = 2,
|
||||
NS_SSL_SERVER = 3,
|
||||
SMIME_SIGN = 4,
|
||||
SMIME_ENCRYPT = 5,
|
||||
CRL_SIGN = 6,
|
||||
ANY = 7,
|
||||
OCSP_HELPER = 8,
|
||||
TIMESTAMP_SIGN = 9,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// BtlsX509Store.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509Store : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509Store Instance {
|
||||
get { return (MonoBtlsX509Store)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509Store (MonoBtlsX509Store store)
|
||||
: base (store)
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadLocations (string file, string path)
|
||||
{
|
||||
Instance.LoadLocations (file, path);
|
||||
}
|
||||
|
||||
public void AddTrustedRoots ()
|
||||
{
|
||||
Instance.AddTrustedRoots ();
|
||||
}
|
||||
|
||||
public void AddCertificate (BtlsX509 x509)
|
||||
{
|
||||
Instance.AddCertificate (x509.Instance);
|
||||
}
|
||||
|
||||
public int GetCount ()
|
||||
{
|
||||
return Instance.GetCount ();
|
||||
}
|
||||
|
||||
public void AddLookup (X509CertificateCollection certificates, BtlsX509TrustKind trust)
|
||||
{
|
||||
Instance.AddCollection (certificates, (MonoBtlsX509TrustKind)trust);
|
||||
}
|
||||
|
||||
static MonoBtlsX509FileType GetFileType (BtlsX509Format format)
|
||||
{
|
||||
switch (format) {
|
||||
case BtlsX509Format.DER:
|
||||
return MonoBtlsX509FileType.ASN1;
|
||||
case BtlsX509Format.PEM:
|
||||
return MonoBtlsX509FileType.PEM;
|
||||
default:
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDirectoryLookup (string dir, BtlsX509Format format)
|
||||
{
|
||||
Instance.AddDirectoryLookup (dir, GetFileType (format));
|
||||
}
|
||||
|
||||
public void AddFileLookup (string file, BtlsX509Format format)
|
||||
{
|
||||
Instance.AddFileLookup (file, GetFileType (format));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// BtlsX509StoreCtx.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509StoreCtx : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509StoreCtx Instance {
|
||||
get { return (MonoBtlsX509StoreCtx)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509StoreCtx (MonoBtlsX509StoreCtx ctx)
|
||||
: base (ctx)
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize (BtlsX509Store store, BtlsX509Chain chain)
|
||||
{
|
||||
Instance.Initialize (store.Instance, chain.Instance);
|
||||
}
|
||||
|
||||
public void SetVerifyParam (BtlsX509VerifyParam param)
|
||||
{
|
||||
Instance.SetVerifyParam (param.Instance);
|
||||
}
|
||||
|
||||
public int Verify ()
|
||||
{
|
||||
return Instance.Verify ();
|
||||
}
|
||||
|
||||
public BtlsX509Error GetError ()
|
||||
{
|
||||
return (BtlsX509Error)Instance.GetError ();
|
||||
}
|
||||
|
||||
public Exception GetException ()
|
||||
{
|
||||
return Instance.GetException ();
|
||||
}
|
||||
|
||||
public BtlsX509Chain GetChain ()
|
||||
{
|
||||
return new BtlsX509Chain (Instance.GetChain ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// BtlsX509StoreManager.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public static class BtlsX509StoreManager
|
||||
{
|
||||
public static bool HasStore (BtlsX509StoreType type)
|
||||
{
|
||||
return MonoBtlsX509StoreManager.HasStore ((MonoBtlsX509StoreType)type);
|
||||
}
|
||||
|
||||
public static string GetStorePath (BtlsX509StoreType type)
|
||||
{
|
||||
return MonoBtlsX509StoreManager.GetStorePath ((MonoBtlsX509StoreType)type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// BtlsX509StoreType.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with MonoBtlsX509StoreType
|
||||
public enum BtlsX509StoreType
|
||||
{
|
||||
Custom,
|
||||
MachineTrustedRoots,
|
||||
MachineIntermediateCA,
|
||||
MachineUntrusted,
|
||||
UserTrustedRoots,
|
||||
UserIntermediateCA,
|
||||
UserUntrusted
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// BtlsX509TrustKind.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with MonoBtlsX509TrustKind
|
||||
[Flags]
|
||||
public enum BtlsX509TrustKind
|
||||
{
|
||||
DEFAULT = 0,
|
||||
TRUST_CLIENT = 1,
|
||||
TRUST_SERVER = 2,
|
||||
TRUST_ALL = 4,
|
||||
REJECT_CLIENT = 32,
|
||||
REJECT_SERVER = 64,
|
||||
REJECT_ALL = 128
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// BtlsX509VerifyFlags.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
// Keep in sync with NativeBoringX509VerifyFlags
|
||||
public enum BtlsX509VerifyFlags
|
||||
{
|
||||
DEFAULT = 0,
|
||||
CRL_CHECK = 1,
|
||||
CRL_CHECK_ALL = 2,
|
||||
X509_STRIC = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// BtlsX509VerifyParam.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public class BtlsX509VerifyParam : BtlsObject
|
||||
{
|
||||
new internal MonoBtlsX509VerifyParam Instance {
|
||||
get { return (MonoBtlsX509VerifyParam)base.Instance; }
|
||||
}
|
||||
|
||||
internal BtlsX509VerifyParam (MonoBtlsX509VerifyParam param)
|
||||
: base (param)
|
||||
{
|
||||
}
|
||||
|
||||
public BtlsX509VerifyParam Copy ()
|
||||
{
|
||||
return new BtlsX509VerifyParam (Instance.Copy ());
|
||||
}
|
||||
|
||||
public void SetName (string name)
|
||||
{
|
||||
Instance.SetName (name);
|
||||
}
|
||||
|
||||
public void SetHost (string name)
|
||||
{
|
||||
Instance.SetHost (name);
|
||||
}
|
||||
|
||||
public void AddHost (string name)
|
||||
{
|
||||
Instance.AddHost (name);
|
||||
}
|
||||
|
||||
public BtlsX509VerifyFlags GetFlags ()
|
||||
{
|
||||
return (BtlsX509VerifyFlags)Instance.GetFlags ();
|
||||
}
|
||||
|
||||
public void SetFlags (BtlsX509VerifyFlags flags)
|
||||
{
|
||||
Instance.SetFlags ((ulong)flags);
|
||||
}
|
||||
|
||||
public void SetPurpose (BtlsX509Purpose purpose)
|
||||
{
|
||||
Instance.SetPurpose ((MonoBtlsX509Purpose)purpose);
|
||||
}
|
||||
|
||||
public int GetDepth ()
|
||||
{
|
||||
return Instance.GetDepth ();
|
||||
}
|
||||
|
||||
public void SetDepth (int depth)
|
||||
{
|
||||
Instance.SetDepth (depth);
|
||||
}
|
||||
|
||||
public void SetTime (DateTime time)
|
||||
{
|
||||
Instance.SetTime (time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// VersionInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
namespace Mono.Btls.Interface
|
||||
{
|
||||
public static class VersionInfo
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
47
mcs/class/Mono.Btls.Interface/Properties/AssemblyInfo.cs
Normal file
47
mcs/class/Mono.Btls.Interface/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about the system assembly
|
||||
|
||||
[assembly: AssemblyVersion (Consts.FxVersion)]
|
||||
|
||||
[assembly: AssemblyCompany ("MONO development team")]
|
||||
[assembly: AssemblyCopyright ("(c) 2016 Xamarin")]
|
||||
[assembly: AssemblyDescription ("Mono.Btls.Interface")]
|
||||
[assembly: AssemblyProduct ("MONO CLI")]
|
||||
[assembly: AssemblyTitle ("Mono.Btls.Interface")]
|
||||
[assembly: CLSCompliant (true)]
|
||||
[assembly: ComVisible (false)]
|
||||
[assembly: NeutralResourcesLanguage ("en-US")]
|
||||
|
||||
Reference in New Issue
Block a user