You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.150
Former-commit-id: 73e3bb1e96dd09dc931c1dfe559d2c7f7b8b02c7
This commit is contained in:
parent
02ac915603
commit
b95516a3dd
@@ -67,6 +67,10 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
get;
|
||||
}
|
||||
|
||||
internal abstract X509CertificateImplCollection IntermediateCertificates {
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract string GetNameInfo (X509NameType nameType, bool forIssuer);
|
||||
|
||||
public abstract void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags);
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
X500DistinguishedName issuer_name;
|
||||
X500DistinguishedName subject_name;
|
||||
Oid signature_algorithm;
|
||||
X509CertificateImplCollection intermediateCerts;
|
||||
|
||||
MX.X509Certificate _cert;
|
||||
|
||||
@@ -77,18 +78,25 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
internal X509Certificate2ImplMono (MX.X509Certificate cert)
|
||||
X509Certificate2ImplMono (MX.X509Certificate cert)
|
||||
{
|
||||
this._cert = cert;
|
||||
}
|
||||
|
||||
X509Certificate2ImplMono (X509Certificate2ImplMono other)
|
||||
{
|
||||
_cert = other._cert;
|
||||
if (other.intermediateCerts != null)
|
||||
intermediateCerts = other.intermediateCerts.Clone ();
|
||||
}
|
||||
|
||||
public override X509CertificateImpl Clone ()
|
||||
{
|
||||
ThrowIfContextInvalid ();
|
||||
return new X509Certificate2ImplMono (_cert);
|
||||
return new X509Certificate2ImplMono (this);
|
||||
}
|
||||
|
||||
#region Implemented X509CertificateImpl members
|
||||
#region Implemented X509CertificateImpl members
|
||||
|
||||
public override string GetIssuerName (bool legacyV1Mode)
|
||||
{
|
||||
@@ -183,7 +191,7 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
// constructors
|
||||
|
||||
@@ -459,6 +467,15 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
cert.RSA = (keypair as RSA);
|
||||
cert.DSA = (keypair as DSA);
|
||||
}
|
||||
if (pfx.Certificates.Count > 1) {
|
||||
intermediateCerts = new X509CertificateImplCollection ();
|
||||
foreach (var c in pfx.Certificates) {
|
||||
if (c == cert)
|
||||
continue;
|
||||
var impl = new X509Certificate2ImplMono (c);
|
||||
intermediateCerts.Add (impl, true);
|
||||
}
|
||||
}
|
||||
return cert;
|
||||
}
|
||||
}
|
||||
@@ -546,6 +563,10 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
issuer_name = null;
|
||||
subject_name = null;
|
||||
signature_algorithm = null;
|
||||
if (intermediateCerts != null) {
|
||||
intermediateCerts.Dispose ();
|
||||
intermediateCerts = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
@@ -687,6 +708,10 @@ namespace System.Security.Cryptography.X509Certificates
|
||||
return GetCertContentType (data);
|
||||
}
|
||||
|
||||
internal override X509CertificateImplCollection IntermediateCertificates {
|
||||
get { return intermediateCerts; }
|
||||
}
|
||||
|
||||
// internal stuff because X509Certificate2 isn't complete enough
|
||||
// (maybe X509Certificate3 will be better?)
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// X509CertificateImplCollection.cs
|
||||
//
|
||||
// Authors:
|
||||
// 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.
|
||||
//
|
||||
#if SECURITY_DEP
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates
|
||||
{
|
||||
internal class X509CertificateImplCollection : IDisposable
|
||||
{
|
||||
List<X509CertificateImpl> list;
|
||||
|
||||
public X509CertificateImplCollection ()
|
||||
{
|
||||
list = new List<X509CertificateImpl> ();
|
||||
}
|
||||
|
||||
X509CertificateImplCollection (X509CertificateImplCollection other)
|
||||
{
|
||||
list = new List<X509CertificateImpl> ();
|
||||
foreach (var impl in other.list)
|
||||
list.Add (impl.Clone ());
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return list.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public X509CertificateImpl this[int index] {
|
||||
get {
|
||||
return list[index];
|
||||
}
|
||||
}
|
||||
|
||||
public void Add (X509CertificateImpl impl, bool takeOwnership)
|
||||
{
|
||||
if (!takeOwnership)
|
||||
impl = impl.Clone ();
|
||||
list.Add (impl);
|
||||
}
|
||||
|
||||
public X509CertificateImplCollection Clone ()
|
||||
{
|
||||
return new X509CertificateImplCollection (this);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose (bool disposing)
|
||||
{
|
||||
foreach (var impl in list) {
|
||||
try {
|
||||
impl.Dispose ();
|
||||
} catch {
|
||||
;
|
||||
}
|
||||
}
|
||||
list.Clear ();
|
||||
}
|
||||
|
||||
~X509CertificateImplCollection ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -37,6 +37,7 @@ using MX = MonoSecurity::Mono.Security.X509;
|
||||
using MX = Mono.Security.X509;
|
||||
#endif
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
|
||||
@@ -113,6 +114,10 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
get { return Impl.ChainStatus; }
|
||||
}
|
||||
|
||||
public SafeX509ChainHandle SafeHandle {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
|
||||
// methods
|
||||
|
||||
[MonoTODO ("Not totally RFC3280 compliant, but neither is MS implementation...")]
|
||||
|
||||
@@ -53,7 +53,10 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
CtlNotSignatureValid = 262144,
|
||||
CtlNotValidForUsage = 524288,
|
||||
OfflineRevocation = 16777216,
|
||||
NoIssuanceChainPolicy = 33554432
|
||||
NoIssuanceChainPolicy = 33554432,
|
||||
ExplicitDistrust = 67108864,
|
||||
HasNotSupportedCriticalExtension = 134217728,
|
||||
HasWeakSignature = 1048576,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ using System.Security.Permissions;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public sealed class X509Store {
|
||||
public sealed class X509Store : IDisposable {
|
||||
|
||||
private string _name;
|
||||
private StoreLocation _location;
|
||||
@@ -208,6 +208,11 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
list.Clear ();
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Close ();
|
||||
}
|
||||
|
||||
public void Open (OpenFlags flags)
|
||||
{
|
||||
if (String.IsNullOrEmpty (_name))
|
||||
|
||||
Reference in New Issue
Block a user