Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/Microsoft.Private.PackageBaseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@
"4.0.0.0": "4.1.0",
"4.1.0.0": "4.1.0",
"4.1.1.0": "4.3.0",
"4.1.2.0": "4.4.0"
"4.2.0.0": "4.4.0"
}
},
"System.Security.Principal": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0\System.Security.Cryptography.X509Certificates.csproj">
<SupportedFramework>net46</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\ref\System.Security.Cryptography.X509Certificates.csproj">
<SupportedFramework>net461;netcore50;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>net463;netcoreapp1.1;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.Security.Cryptography.X509Certificates.builds" />
</ItemGroup>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------


namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeX509ChainHandle : System.Runtime.InteropServices.SafeHandle
{
internal SafeX509ChainHandle() : base(default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { return default(bool); } }
protected override void Dispose(bool disposing) { }
protected override bool ReleaseHandle() { return default(bool); }
}
}

namespace System.Security.Cryptography.X509Certificates
{
public static partial class ECDsaCertificateExtensions
Expand Down Expand Up @@ -99,12 +101,12 @@ public X509Certificate() { }
public X509Certificate(byte[] data) { }
public X509Certificate(byte[] rawData, string password) { }
public X509Certificate(byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { }
[System.Security.SecurityCriticalAttribute]
public X509Certificate(System.IntPtr handle) { }
public X509Certificate(System.Security.Cryptography.X509Certificates.X509Certificate cert) { }
public X509Certificate(string fileName) { }
public X509Certificate(string fileName, string password) { }
public X509Certificate(string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { }
public System.IntPtr Handle {[System.Security.SecurityCriticalAttribute]get { return default(System.IntPtr); } }
public System.IntPtr Handle { get { return default(System.IntPtr); } }
public string Issuer { get { return default(string); } }
public string Subject { get { return default(string); } }
public void Dispose() { }
Expand All @@ -114,13 +116,24 @@ protected virtual void Dispose(bool disposing) { }
public virtual byte[] Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType) { return default(byte[]); }
public virtual byte[] Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType, string password) { return default(byte[]); }
public virtual byte[] GetCertHash() { return default(byte[]); }
public virtual string GetCertHashString() { return default(string); }
public virtual string GetEffectiveDateString() { return default(string); }
public virtual string GetExpirationDateString() { return default(string); }
public virtual string GetFormat() { return default(string); }
public override int GetHashCode() { return default(int); }
[System.ObsoleteAttribute("This method has been deprecated. Please use the Issuer property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public virtual string GetIssuerName() { return default(string); }
public virtual string GetKeyAlgorithm() { return default(string); }
public virtual byte[] GetKeyAlgorithmParameters() { return default(byte[]); }
public virtual string GetKeyAlgorithmParametersString() { return default(string); }
[System.ObsoleteAttribute("This method has been deprecated. Please use the Subject property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public virtual string GetName() { return default(string); }
public virtual byte[] GetPublicKey() { return default(byte[]); }
public virtual string GetPublicKeyString() { return default(string); }
public virtual byte[] GetRawCertData() { return default(byte[]); }
public virtual string GetRawCertDataString() { return default(string); }
public virtual byte[] GetSerialNumber() { return default(byte[]); }
public virtual string GetSerialNumberString() { return default(string); }
public override string ToString() { return default(string); }
public virtual string ToString(bool fVerbose) { return default(string); }
}
Expand All @@ -131,6 +144,7 @@ public X509Certificate2(byte[] rawData) { }
public X509Certificate2(byte[] rawData, string password) { }
public X509Certificate2(byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { }
public X509Certificate2(System.IntPtr handle) { }
public X509Certificate2(System.Security.Cryptography.X509Certificates.X509Certificate cert) { }
public X509Certificate2(string fileName) { }
public X509Certificate2(string fileName, string password) { }
public X509Certificate2(string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) { }
Expand Down Expand Up @@ -188,22 +202,37 @@ public void Reset() { }
bool System.Collections.IEnumerator.MoveNext() { return default(bool); }
void System.Collections.IEnumerator.Reset() { }
}
public partial class X509CertificateCollection
public partial class X509CertificateCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public X509CertificateCollection() { }
public X509CertificateCollection(System.Security.Cryptography.X509Certificates.X509Certificate[] value) { }
public X509CertificateCollection(System.Security.Cryptography.X509Certificates.X509CertificateCollection value) { }
public int Count { get { return default(int); } }
public System.Security.Cryptography.X509Certificates.X509Certificate this[int index] { get { return default(System.Security.Cryptography.X509Certificates.X509Certificate); } set { } }
bool System.Collections.ICollection.IsSynchronized { get { return default(bool); } }
object System.Collections.ICollection.SyncRoot { get { return default(object); } }
bool System.Collections.IList.IsFixedSize { get { return default(bool); } }
bool System.Collections.IList.IsReadOnly { get { return default(bool); } }
object System.Collections.IList.this[int index] { get { return default(object); } set { } }
public int Add(System.Security.Cryptography.X509Certificates.X509Certificate value) { return default(int); }
public void AddRange(System.Security.Cryptography.X509Certificates.X509Certificate[] value) { }
public void AddRange(System.Security.Cryptography.X509Certificates.X509CertificateCollection value) { }
public void Clear() { }
public bool Contains(System.Security.Cryptography.X509Certificates.X509Certificate value) { return default(bool); }
public void CopyTo(System.Security.Cryptography.X509Certificates.X509Certificate[] array, int index) { }
public System.Security.Cryptography.X509Certificates.X509CertificateCollection.X509CertificateEnumerator GetEnumerator() { return default(System.Security.Cryptography.X509Certificates.X509CertificateCollection.X509CertificateEnumerator); }
public override int GetHashCode() { return default(int); }
public int IndexOf(System.Security.Cryptography.X509Certificates.X509Certificate value) { return default(int); }
public void Insert(int index, System.Security.Cryptography.X509Certificates.X509Certificate value) { }
public void Remove(System.Security.Cryptography.X509Certificates.X509Certificate value) { }
public void RemoveAt(int index) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return default(System.Collections.IEnumerator); }
int System.Collections.IList.Add(object value) { return default(int); }
bool System.Collections.IList.Contains(object value) { return default(bool); }
int System.Collections.IList.IndexOf(object value) { return default(int); }
void System.Collections.IList.Insert(int index, object value) { }
void System.Collections.IList.Remove(object value) { }
public partial class X509CertificateEnumerator : System.Collections.IEnumerator
{
public X509CertificateEnumerator(System.Security.Cryptography.X509Certificates.X509CertificateCollection mappings) { }
Expand Down Expand Up @@ -370,6 +399,13 @@ public enum X509FindType
FindByTimeNotYetValid = 7,
FindByTimeValid = 6,
}
public enum X509IncludeOption
{
EndCertOnly = 2,
ExcludeRoot = 1,
None = 0,
WholeChain = 3,
}
[System.FlagsAttribute]
public enum X509KeyStorageFlags
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Security.Cryptography.X509Certificates.cs" />
<Compile Include="System.Security.Cryptography.X509Certificates.Manual.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"dependencies": {
"System.IO": "4.0.0",
"System.Runtime": "4.0.0",
"System.Runtime.Handles": "4.0.0",
"System.Security.Cryptography.Primitives": "4.0.0",
"System.Security.Cryptography.Algorithms": "4.2.0",
"System.Security.Cryptography.Encoding": "4.0.0"
"System.Runtime": "4.3.0-beta-24604-02",
"System.Security.Cryptography.Algorithms": "4.3.0-beta-24604-02",
"System.Security.Cryptography.Encoding": "4.3.0-beta-24604-02",
"System.Security.Cryptography.Primitives": "4.3.0-beta-24604-02"
},
"frameworks": {
"netstandard1.4": {
"netstandard1.7": {
"imports": [
"dotnet5.5"
"dotnet5.8"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ public static ICertificatePal FromHandle(IntPtr handle)
return new OpenSslX509CertificateReader(Interop.Crypto.X509UpRef(handle));
}

public static ICertificatePal FromOtherCert(X509Certificate cert)
{
Debug.Assert(cert.Pal != null);

// Ensure private key is copied
OpenSslX509CertificateReader certPal = (OpenSslX509CertificateReader)cert.Pal;
return certPal.DuplicateHandles();
}

public static ICertificatePal FromBlob(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
{
ICertificatePal cert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private static SafeNCryptKeyHandle TryAcquireCngPrivateKey(SafeCertContextHandle
out keySpec,
out freeKey))
{
int dwErrorCode = Marshal.GetLastWin32Error();
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ public static ICertificatePal FromHandle(IntPtr handle)
return new CertificatePal(safeCertContextHandle, deleteKeyContainer);
}

/// <summary>
/// Returns the SafeCertContextHandle. Use this instead of FromHandle property when
/// creating another X509Certificate object based on this one to ensure the underlying
/// cert context is not released at the wrong time.
/// </summary>
/// <param name="cert"></param>
/// <returns></returns>
public static ICertificatePal FromOtherCert(X509Certificate cert)
{
CertificatePal newCert = (CertificatePal)FromHandle(cert.Handle);
newCert._certContextCloned = true;

((CertificatePal)cert.Pal)._certContextCloned = true;

return newCert;
}

public IntPtr Handle
{
get { return _certContext.DangerousGetHandle(); }
Expand Down Expand Up @@ -471,7 +488,10 @@ public void Dispose()
_certContext = null;
if (certContext != null && !certContext.IsInvalid)
{
certContext.Dispose();
if (!_certContextCloned)
{
certContext.Dispose();
}
}
}

Expand Down Expand Up @@ -541,5 +561,6 @@ private CertificatePal(SafeCertContextHandle certContext, bool deleteKeyContaine
}

private SafeCertContextHandle _certContext;
private bool _certContextCloned;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@
</Project>
<Project Include="System.Security.Cryptography.X509Certificates.csproj">
<OSGroup>Windows_NT</OSGroup>
<TargetGroup>netcore50</TargetGroup>
</Project>
<Project Include="System.Security.Cryptography.X509Certificates.csproj">
<OSGroup>Windows_NT</OSGroup>
<TargetGroup>net46</TargetGroup>
</Project>
<Project Include="System.Security.Cryptography.X509Certificates.csproj">
<OSGroup>Windows_NT</OSGroup>
<TargetGroup>net461</TargetGroup>
<TargetGroup>net463</TargetGroup>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
Expand Down
Loading