Skip to content

Commit

Permalink
Added back net461 target
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersAbel committed Oct 15, 2018
1 parent 64a42be commit 93f0e31
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sustainsys.Saml2.HttpModule</RootNamespace>
<AssemblyName>Sustainsys.Saml2.HttpModule</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Sustainsys.Saml2.Mvc/Sustainsys.Saml2.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sustainsys.Saml2.Mvc</RootNamespace>
<AssemblyName>Sustainsys.Saml2.Mvc</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Sustainsys.Saml2.Owin/Sustainsys.Saml2.Owin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sustainsys.Saml2.Owin</RootNamespace>
<AssemblyName>Sustainsys.Saml2.Owin</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
15 changes: 11 additions & 4 deletions Sustainsys.Saml2/Metadata/KeyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public RsaKeyValue(RSAParameters parameters)
}
}

public class EcKeyValue : KeyValue
#if !NET461

public class EcKeyValue : KeyValue
{
public ECParameters Parameters { get; set; }

Expand All @@ -84,7 +86,9 @@ public EcKeyValue(ECParameters parameters)
}
}

public class DSigKeyInfo
#endif

public class DSigKeyInfo
{
public string Id { get; set; }
public ICollection<string> KeyNames { get; private set; } =
Expand All @@ -109,11 +113,13 @@ public SecurityKeyIdentifier MakeSecurityKeyIdentifier()
{
ski.Add(new DsaKeyIdentifierClause(dsaKeyValue.Parameters));
}
else if (keyValue is EcKeyValue ecKeyValue)
#if !NET461
else if (keyValue is EcKeyValue ecKeyValue)
{
ski.Add(new EcKeyIdentifierClause(ecKeyValue.Parameters));
}
}
#endif
}
foreach (string keyName in KeyNames)
{
ski.Add(new KeyNameIdentifierClause(keyName));
Expand All @@ -137,3 +143,4 @@ public SecurityKeyIdentifier MakeSecurityKeyIdentifier()
}
}
}

48 changes: 30 additions & 18 deletions Sustainsys.Saml2/Metadata/MetadataSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,9 @@ byte[] ParseBigIntValue(string value, string parameterName)
return intValue.ToByteArray();
}

protected virtual EcKeyValue ReadECDSAKeyValue(XmlReader reader)
#if !NET461

protected virtual EcKeyValue ReadECDSAKeyValue(XmlReader reader)
{
if (reader == null)
{
Expand Down Expand Up @@ -837,17 +839,19 @@ protected virtual EcKeyValue ReadECKeyValue(XmlReader reader)
return new EcKeyValue(parameters);
}

// <element name = "KeyValue" type="ds:KeyValueType" />
// <complexType name = "KeyValueType" mixed="true">
// <choice>
// <element ref="ds:DSAKeyValue"/>
// <element ref="ds:RSAKeyValue"/>
// <!-- <element ref="dsig11:ECKeyValue"/> -->
// <!-- ECC keys(XMLDsig 1.1) will use the any element -->
// <any namespace="##other" processContents="lax"/>
// </choice>
// </complexType>
protected virtual KeyValue ReadKeyValue(XmlReader reader)
#endif

// <element name = "KeyValue" type="ds:KeyValueType" />
// <complexType name = "KeyValueType" mixed="true">
// <choice>
// <element ref="ds:DSAKeyValue"/>
// <element ref="ds:RSAKeyValue"/>
// <!-- <element ref="dsig11:ECKeyValue"/> -->
// <!-- ECC keys(XMLDsig 1.1) will use the any element -->
// <any namespace="##other" processContents="lax"/>
// </choice>
// </complexType>
protected virtual KeyValue ReadKeyValue(XmlReader reader)
{
if (reader == null)
{
Expand All @@ -867,14 +871,16 @@ protected virtual KeyValue ReadKeyValue(XmlReader reader)
{
value = ReadRSAKeyValue(reader);
}
else if (reader.IsStartElement("ECKeyValue", DSig11Ns))
#if !NET461
else if (reader.IsStartElement("ECKeyValue", DSig11Ns))
{
value = ReadECKeyValue(reader);
}
else if (reader.IsStartElement("ECDSAKeyValue", EcDsaNs))
else if (reader.IsStartElement("ECDSAKeyValue", EcDsaNs))
{
value = ReadECDSAKeyValue(reader);
}
#endif
else
{
value = ReadCustomKeyValue(reader);
Expand Down Expand Up @@ -3873,7 +3879,9 @@ protected virtual void WriteDSAKeyValue(XmlWriter writer, DsaKeyValue dsa)
writer.WriteEndElement();
}

protected virtual void WriteECKeyValue(XmlWriter writer, EcKeyValue ec)
#if !NET461

protected virtual void WriteECKeyValue(XmlWriter writer, EcKeyValue ec)
{
if (writer == null)
{
Expand Down Expand Up @@ -3902,7 +3910,9 @@ protected virtual void WriteECKeyValue(XmlWriter writer, EcKeyValue ec)
writer.WriteEndElement();
}

protected virtual void WriteKeyValue(XmlWriter writer, KeyValue keyValue)
#endif

protected virtual void WriteKeyValue(XmlWriter writer, KeyValue keyValue)
{
if (writer == null)
{
Expand All @@ -3922,11 +3932,13 @@ protected virtual void WriteKeyValue(XmlWriter writer, KeyValue keyValue)
{
WriteDSAKeyValue(writer, dsa);
}
else if (keyValue is EcKeyValue ec)
#if !NET461
else if (keyValue is EcKeyValue ec)
{
WriteECKeyValue(writer, ec);
}
WriteCustomElements(writer, keyValue);
#endif
WriteCustomElements(writer, keyValue);
writer.WriteEndElement();
}

Expand Down
2 changes: 1 addition & 1 deletion Sustainsys.Saml2/Sustainsys.Saml2.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net47</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net47;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageReleaseNotes>$releaseNotes$</PackageReleaseNotes>
<PackageLicenseUrl>https://github.com/Sustainsys/Saml2/blob/master/LICENSE</PackageLicenseUrl>
Expand Down
6 changes: 5 additions & 1 deletion Sustainsys.Saml2/Tokens/EcKeyIdentifierClause.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Security.Cryptography;
using Sustainsys.Saml2.Internal;

#if !NET461

namespace Sustainsys.Saml2.Tokens
{
static class EcUtils
static class EcUtils
{
public static bool ByteArraysEqual(byte[] a, byte[] b) =>
CompareHelper.ByteArraysEqual(a, b);
Expand Down Expand Up @@ -338,3 +340,5 @@ public bool Matches(ECParameters other)
}
}
}

#endif

0 comments on commit 93f0e31

Please sign in to comment.