You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -68,61 +68,68 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public X509Certificate2 (byte[] rawData)
|
||||
{
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
// MONO: temporary hack until `X509CertificateImplApple` derives from
|
||||
// `X509Certificate2Impl`.
|
||||
if (rawData != null && rawData.Length != 0) {
|
||||
using (var safePasswordHandle = new SafePasswordHandle ((string)null)) {
|
||||
var impl = X509Helper.Import (rawData, safePasswordHandle, X509KeyStorageFlags.DefaultKeySet);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, string password)
|
||||
: base (rawData, password)
|
||||
{
|
||||
Import (rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, SecureString password)
|
||||
: base (rawData, password)
|
||||
{
|
||||
Import (rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (rawData, password, keyStorageFlags)
|
||||
{
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (rawData, password, keyStorageFlags)
|
||||
{
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName)
|
||||
: base (fileName)
|
||||
{
|
||||
Import (fileName, String.Empty, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, string password)
|
||||
: base (fileName, password)
|
||||
{
|
||||
Import (fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, SecureString password)
|
||||
: base (fileName, password)
|
||||
{
|
||||
Import (fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (fileName, password, keyStorageFlags)
|
||||
{
|
||||
Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (fileName, password, keyStorageFlags)
|
||||
{
|
||||
Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (IntPtr handle) : base (handle)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public X509Certificate2 (X509Certificate certificate)
|
||||
: base (SystemDependencyProvider.Instance.CertificateProvider.Import (certificate))
|
||||
: base (certificate)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -175,8 +182,10 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public AsymmetricAlgorithm PrivateKey {
|
||||
get { return Impl.PrivateKey; }
|
||||
set { Impl.PrivateKey = value; }
|
||||
}
|
||||
set {
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public PublicKey PublicKey {
|
||||
get { return Impl.PublicKey; }
|
||||
@@ -216,46 +225,32 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public override void Import (byte[] rawData)
|
||||
{
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
base.Import (rawData);
|
||||
}
|
||||
|
||||
[MonoTODO ("missing KeyStorageFlags support")]
|
||||
public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
Reset ();
|
||||
using (var handle = new SafePasswordHandle (password)) {
|
||||
var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
base.Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public override void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
Reset ();
|
||||
using (var handle = new SafePasswordHandle (password)) {
|
||||
var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
base.Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public override void Import (string fileName)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
base.Import (fileName);
|
||||
}
|
||||
|
||||
[MonoTODO ("missing KeyStorageFlags support")]
|
||||
public override void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
base.Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
[MonoTODO ("SecureString is incomplete")]
|
||||
public override void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
base.Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
[MonoTODO ("X509ContentType.SerializedCert is not supported")]
|
||||
|
@@ -333,8 +333,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (byte[] rawData)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (rawData);
|
||||
X509Certificate2 cert = new X509Certificate2 (rawData);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -342,8 +341,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (rawData, password, keyStorageFlags);
|
||||
X509Certificate2 cert = new X509Certificate2 (rawData, password, keyStorageFlags);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -351,8 +349,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (string fileName)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (fileName);
|
||||
X509Certificate2 cert = new X509Certificate2 (fileName);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -360,8 +357,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (fileName, password, keyStorageFlags);
|
||||
X509Certificate2 cert = new X509Certificate2 (fileName, password, keyStorageFlags);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
|
@@ -29,8 +29,6 @@
|
||||
|
||||
#if SECURITY_DEP
|
||||
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public class X509ChainElement {
|
||||
|
@@ -237,7 +237,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
foreach (MX.X509Certificate x in store.Certificates) {
|
||||
var cert2 = new X509Certificate2 (x.RawData);
|
||||
cert2.PrivateKey = x.RSA;
|
||||
cert2.Impl.PrivateKey = x.RSA;
|
||||
Certificates.Add (cert2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user