Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Barton <jbarton@microsoft.com>2017-03-13 20:25:42 +0300
committerJeremy Barton <jbarton@microsoft.com>2017-03-13 20:25:42 +0300
commit5382ff2d042e273aa6b76dc7d48277aa0b23145b (patch)
treea7783dcf71556a69e8fafe9f76e28c334d8bb261 /src/System.Security.Cryptography.Xml
parentc66ad920d0f63acd8fb9b47508ba7a741f066150 (diff)
parent6abde68de9611895fa8697fb7fc17105e906081e (diff)
Merge remote-tracking branch 'dotnet/master' into master_to_apple_crypto
Conflicts: src/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs
Diffstat (limited to 'src/System.Security.Cryptography.Xml')
-rw-r--r--src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSAKeyValue.cs4
-rw-r--r--src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs15
-rw-r--r--src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs5
3 files changed, 18 insertions, 6 deletions
diff --git a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSAKeyValue.cs b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSAKeyValue.cs
index 3f30fe3cf3..d5dbd26a99 100644
--- a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSAKeyValue.cs
+++ b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSAKeyValue.cs
@@ -186,12 +186,12 @@ namespace System.Security.Cryptography.Xml
Key.ImportParameters(new DSAParameters
{
P = (pNode != null) ? Convert.FromBase64String(pNode.InnerText) : null,
- Q = (pNode != null) ? Convert.FromBase64String(qNode.InnerText) : null,
+ Q = (qNode != null) ? Convert.FromBase64String(qNode.InnerText) : null,
G = (gNode != null) ? Convert.FromBase64String(gNode.InnerText) : null,
Y = Convert.FromBase64String(yNode.InnerText),
J = (jNode != null) ? Convert.FromBase64String(jNode.InnerText) : null,
Seed = (seedNode != null) ? Convert.FromBase64String(seedNode.InnerText) : null,
- Counter = (seedNode != null) ? Convert.FromBase64String(pgenCounterNode.InnerText)[0] : 0
+ Counter = (pgenCounterNode != null) ? Utils.ConvertByteArrayToInt(Convert.FromBase64String(pgenCounterNode.InnerText)) : 0
});
}
catch (Exception ex)
diff --git a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
index 7f1cb03a4c..5f49e603b0 100644
--- a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
+++ b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
@@ -583,6 +583,18 @@ namespace System.Security.Cryptography.Xml
return rgbOutput;
}
+ internal static int ConvertByteArrayToInt(byte[] input)
+ {
+ // Input to this routine is always big endian
+ int dwOutput = 0;
+ for (int i = 0; i < input.Length; i++)
+ {
+ dwOutput *= 256;
+ dwOutput += input[i];
+ }
+ return (dwOutput);
+ }
+
internal static int GetHexArraySize(byte[] hex)
{
int index = hex.Length;
@@ -742,8 +754,7 @@ namespace System.Security.Cryptography.Xml
internal static AsymmetricAlgorithm GetAnyPublicKey(X509Certificate2 certificate)
{
- // TODO: Add ?? certificate.GetDSAPublicKey(), when available (dotnet/corefx#11802).
- return certificate.GetRSAPublicKey();
+ return (AsymmetricAlgorithm)certificate.GetRSAPublicKey() ?? certificate.GetDSAPublicKey();
}
}
}
diff --git a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs
index aa2b46efd7..aee1a62648 100644
--- a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs
+++ b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs
@@ -284,7 +284,8 @@ namespace System.Security.Cryptography.Xml.Tests
Assert.True(v1.CheckSignature());
}
- [Fact(Skip = "https://github.com/dotnet/corefx/issues/16691")]
+ [Fact]
+ [ActiveIssue(17001, TestPlatforms.OSX)]
public void AsymmetricDSASignature()
{
SignedXml signedXml = MSDNSample();
@@ -308,7 +309,7 @@ namespace System.Security.Cryptography.Xml.Tests
Assert.Null(signedXml.SignatureLength);
Assert.Equal(SignedXml.XmlDsigDSAUrl, signedXml.SignatureMethod);
- Assert.Equal(40, signedXml.SignatureValue.Length);
+ Assert.InRange(signedXml.SignatureValue.Length, low: 40, high: Int32.MaxValue);
Assert.Null(signedXml.SigningKeyName);
// Get the XML representation of the signature.