Skip to content

Commit

Permalink
Add ifdef to support Net5.0 build with ECC support (#1367)
Browse files Browse the repository at this point in the history
- for dev only ifdefs,  but not added to target props
  • Loading branch information
mregen committed Apr 19, 2021
1 parent 88b16b3 commit c996e79
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public override void CopyFrom(AsnEncodedData asnEncodedData)
/// <summary>
/// The OID for a Subject Alternate Name 2 extension.
/// </summary>
public static string SubjectAltName2Oid = "2.5.29.17";
public const string SubjectAltName2Oid = "2.5.29.17";

/// <summary>
/// Gets the uris.
Expand Down Expand Up @@ -272,7 +272,7 @@ private string IPAddressToString(byte[] encodedIPAddress)
}
}

#if NETSTANDARD2_1 || NET472
#if NETSTANDARD2_1 || NET472 || NET5_0
/// <summary>
/// Encode the Subject Alternative name extension.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<DefineConstants>$(DefineConstants);ECC_SUPPORT</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">
<DefineConstants>$(DefineConstants);ECC_SUPPORT</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PackageId>$(PackageId).Debug</PackageId>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

using System;
using System.Security.Cryptography;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0
using System;
using System.Security.Cryptography;
using Org.BouncyCastle.Crypto.Prng;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

using Org.BouncyCastle.Asn1.X509;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if !NETSTANDARD2_1
#if !NETSTANDARD2_1 && !NET5_0
using System;
using System.Security.Cryptography;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if !NETSTANDARD2_1
#if !NETSTANDARD2_1 && !NET5_0

using System;
using System.Security.Cryptography.X509Certificates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

using System;
using System.Security.Cryptography;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#if !NETSTANDARD2_1
#if !NETSTANDARD2_1 && !NET5_0
using System;
using System.IO;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Opc.Ua.Security.Certificates/PEM/PEMReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET5_0

using System;
using System.Security.Cryptography;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Opc.Ua.Security.Certificates/PEM/PEMWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET5_0

using System;
using System.Security.Cryptography.X509Certificates;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

// This source code is intentionally copied from the .NET core runtime to close
// a gap in the .NET 4.6 and the .NET Core 2.x runtime implementations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if !NETSTANDARD2_1 && !NET472
#if !NETSTANDARD2_1 && !NET472 && !NET5_0

// This source code is intentionally copied from the .NET core runtime to close
// a gap in the .NET 4.6 and the .NET Core 2.x runtime implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if NETSTANDARD2_1 || NET472
#if NETSTANDARD2_1 || NET472 || NET5_0

using System;
using System.Security.Cryptography;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ DateTime nextUpdate
return new X509CRL(crlBuilder.CreateForRSA(issuerCertificate));
}

#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET5_0
/// <summary>
/// Creates a certificate signing request from an existing certificate.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Task Add(X509Certificate2 certificate, string password = null)
store.Open(OpenFlags.ReadWrite);
if (!store.Certificates.Contains(certificate))
{
#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET5_0
if (certificate.HasPrivateKey &&
(Environment.OSVersion.Platform == PlatformID.Win32NT))
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Opc.Ua.Gds.Tests/PushTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void CreateSigningRequestNullParms()
[Test, Order(402)]
public void CreateSigningRequestRsaMinNullParms()
{
#if NETSTANDARD2_1
#if NETSTANDARD2_1 || NET5_0
Assert.Ignore("SHA1 not supported on .NET Standard 2.1.");
#endif
ConnectPushClient(true);
Expand Down

0 comments on commit c996e79

Please sign in to comment.