diff --git a/makefile.shade b/makefile.shade
index ad1b0d192a..2364f26b21 100644
--- a/makefile.shade
+++ b/makefile.shade
@@ -1,45 +1,86 @@
-use assembly='WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
-use namespace='System.IO.Packaging'
-
-var VERSION='0.1'
-var FULL_VERSION='0.1'
-var AUTHORS='Microsoft Open Technologies, Inc.'
-
-use-standard-lifecycle
-k-standard-goals
-
-#nupkg-patch target='compile'
- @{
- var packagePaths = Files.Include("artifacts/build/**/Microsoft.AspNet.DataProtection.SystemWeb.*.nupkg")
- .Exclude("**/*.symbols.nupkg");
- foreach (var packagePath in packagePaths)
- {
- using (var package = Package.Open(packagePath, FileMode.Open, FileAccess.ReadWrite))
- {
- CreatePartFromFile(
- package,
- @"src\Microsoft.AspNet.DataProtection.SystemWeb\web.config.transform",
- @"content\net451\web.config.transform");
- }
- }
- }
-
-functions
- @{
- PackagePart CreatePartFromFile(
- Package destination,
- string sourceFileName,
- string partUriString)
- {
- var partUri = PackUriHelper.CreatePartUri(new Uri(partUriString, UriKind.Relative));
- var packagePart = destination.CreatePart(partUri, "application/octet", CompressionOption.Maximum);
-
- using (var sourceStream = File.OpenRead(sourceFileName))
- using (var stream = packagePart.GetStream())
- {
- sourceStream.CopyTo(stream);
- }
-
- return packagePart;
- }
- }
+use assembly='WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
+use namespace='System.IO.Packaging'
+use import="Environment"
+
+var VERSION='0.1'
+var FULL_VERSION='0.1'
+var AUTHORS='Microsoft Open Technologies, Inc.'
+
+use-standard-lifecycle
+k-standard-goals
+
+var Configuration2='${E("Configuration")}'
+var ROOT = '${Directory.GetCurrentDirectory()}'
+var BUILD_DIR2 = '${Path.Combine(ROOT, "build")}'
+
+#build-compile target='compile' if='!IsWindows && !IsBuildV2 && Directory.Exists("src")'
+ @{
+ var projectFiles = Files.Include("src/**/project.json")
+ .Exclude("src/Microsoft.AspNet.DataProtection.SystemWeb/project.json")
+ .ToList();
+
+ if (ShouldRunInParallel)
+ {
+ Parallel.ForEach(projectFiles, projectFile => DnuPack(projectFile, BUILD_DIR2, Configuration2));
+ }
+ else
+ {
+ projectFiles.ForEach(projectFile => DnuPack(projectFile, BUILD_DIR2, Configuration2));
+ }
+
+ foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR2, "*/*.nupkg")))
+ {
+ File.Copy(nupkg, Path.Combine(BUILD_DIR2, Path.GetFileName(nupkg)), true);
+ }
+ }
+
+#build-compile target='compile' if='!IsWindows && IsBuildV2'
+ @{
+ if (Directory.Exists("src"))
+ {
+ var projects = Files.Include("src/*")
+ .Exclude("src/Microsoft.AspNet.DataProtection.SystemWeb")
+ .ToList();
+
+ DnuPack(string.Join(";", projects), BUILD_DIR2, Configuration2);
+
+ foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR2, "*/*.nupkg")))
+ {
+ File.Copy(nupkg, Path.Combine(BUILD_DIR2, Path.GetFileName(nupkg)), true);
+ }
+ }
+
+ if (Directory.Exists("test"))
+ {
+ DnuBuild("test/*", Configuration2);
+ }
+ }
+
+functions
+ @{
+ PackagePart CreatePartFromFile(
+ Package destination,
+ string sourceFileName,
+ string partUriString)
+ {
+ var partUri = PackUriHelper.CreatePartUri(new Uri(partUriString, UriKind.Relative));
+ var packagePart = destination.CreatePart(partUri, "application/octet", CompressionOption.Maximum);
+
+ using (var sourceStream = File.OpenRead(sourceFileName))
+ using (var stream = packagePart.GetStream())
+ {
+ sourceStream.CopyTo(stream);
+ }
+
+ return packagePart;
+ }
+
+ bool IsWindows
+ {
+ get
+ {
+ var p = (int)Environment.OSVersion.Platform;
+ return (p != 4) && (p != 6) && (p != 128);
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Cryptography.Internal/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Cryptography.Internal/Properties/AssemblyInfo.cs
index 5f65cef6e8..bc9a2929e1 100644
--- a/src/Microsoft.AspNet.Cryptography.Internal/Properties/AssemblyInfo.cs
+++ b/src/Microsoft.AspNet.Cryptography.Internal/Properties/AssemblyInfo.cs
@@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Cryptography.KeyDerivation.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.DataProtection")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.DataProtection.Abstractions.Test")]
+[assembly: InternalsVisibleTo("Microsoft.AspNet.DataProtection.Extensions.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.DataProtection.Test")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-US")]
diff --git a/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json b/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json
index 40e3e96d4f..65738ec429 100644
--- a/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json
+++ b/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json
@@ -20,5 +20,8 @@
},
"compilationOptions": {
"warningsAsErrors": true
+ },
+ "packInclude": {
+ "content/net451/": "web.config.transform"
}
}
diff --git a/test/Microsoft.AspNet.DataProtection.Extensions.Test/DataProtectionProviderTests.cs b/test/Microsoft.AspNet.DataProtection.Extensions.Test/DataProtectionProviderTests.cs
index e6d31a4d4d..7bfc8b0d6c 100644
--- a/test/Microsoft.AspNet.DataProtection.Extensions.Test/DataProtectionProviderTests.cs
+++ b/test/Microsoft.AspNet.DataProtection.Extensions.Test/DataProtectionProviderTests.cs
@@ -3,6 +3,7 @@
using System;
using System.IO;
+using Microsoft.AspNet.DataProtection.Test.Shared;
using Microsoft.AspNet.Testing.xunit;
using Xunit;
@@ -36,6 +37,7 @@ namespace Microsoft.AspNet.DataProtection
[ConditionalFact]
[ConditionalRunTestOnlyIfLocalAppDataAvailable]
+ [ConditionalRunTestOnlyOnWindows]
public void System_UsesProvidedDirectory_WithConfigurationCallback()
{
WithUniqueTempDirectory(directory =>
diff --git a/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json b/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json
index 50d98f9f25..f839a2023e 100644
--- a/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json
+++ b/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json
@@ -2,6 +2,7 @@
"dependencies": {
"Microsoft.AspNet.DataProtection.Abstractions": "1.0.0-*",
"Microsoft.AspNet.DataProtection.Extensions": "1.0.0-*",
+ "Microsoft.AspNet.DataProtection.Test.Shared": { "type": "build", "version": "" },
"Microsoft.AspNet.Testing": "1.0.0-*",
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
diff --git a/test/Microsoft.AspNet.DataProtection.Test/KeyManagement/XmlKeyManagerTests.cs b/test/Microsoft.AspNet.DataProtection.Test/KeyManagement/XmlKeyManagerTests.cs
index 2fbe9d9f2d..19c8c75460 100644
--- a/test/Microsoft.AspNet.DataProtection.Test/KeyManagement/XmlKeyManagerTests.cs
+++ b/test/Microsoft.AspNet.DataProtection.Test/KeyManagement/XmlKeyManagerTests.cs
@@ -130,9 +130,9 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
// Finally, was the correct element stored in the repository?
string expectedXml = String.Format(@"
- 2014-01-01T00:00:00Z
- 2014-02-01T00:00:00Z
- 2014-03-01T00:00:00Z
+ {1}
+ {2}
+ {3}
@@ -141,7 +141,10 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
",
- typeof(MyDeserializer).AssemblyQualifiedName);
+ typeof(MyDeserializer).AssemblyQualifiedName,
+ new XElement("creationDate", creationDate),
+ new XElement("activationDate", activationDate),
+ new XElement("expirationDate", expirationDate));
XmlAssert.Equal(expectedXml, elementStoredInRepository);
Assert.Equal("key-3d6d01fd-c0e7-44ae-82dd-013b996b4093", friendlyNameStoredInRepository);
}
@@ -221,9 +224,9 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
// This should not have gone through the encryptor.
string expectedEscrowXml = String.Format(@"
- 2014-01-01T00:00:00Z
- 2014-02-01T00:00:00Z
- 2014-03-01T00:00:00Z
+ {1}
+ {2}
+ {3}
@@ -232,7 +235,10 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
",
- typeof(MyDeserializer).AssemblyQualifiedName);
+ typeof(MyDeserializer).AssemblyQualifiedName,
+ new XElement("creationDate", creationDate),
+ new XElement("activationDate", activationDate),
+ new XElement("expirationDate", expirationDate));
XmlAssert.Equal(expectedEscrowXml, elementStoredInEscrow);
Assert.Equal(keyId, keyIdStoredInEscrow.Value);
@@ -240,9 +246,9 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
// This should have gone through the encryptor (which we set to be the null encryptor in this test)
string expectedRepositoryXml = String.Format(@"
- 2014-01-01T00:00:00Z
- 2014-02-01T00:00:00Z
- 2014-03-01T00:00:00Z
+ {2}
+ {3}
+ {4}
@@ -256,7 +262,10 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
",
typeof(MyDeserializer).AssemblyQualifiedName,
- typeof(NullXmlDecryptor).AssemblyQualifiedName);
+ typeof(NullXmlDecryptor).AssemblyQualifiedName,
+ new XElement("creationDate", creationDate),
+ new XElement("activationDate", activationDate),
+ new XElement("expirationDate", expirationDate));
XmlAssert.Equal(expectedRepositoryXml, elementStoredInRepository);
Assert.Equal("key-3d6d01fd-c0e7-44ae-82dd-013b996b4093", friendlyNameStoredInRepository);
}
@@ -660,7 +669,7 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
var services = serviceCollection.BuildServiceProvider();
var keyManager = new XmlKeyManager(services);
- var revocationDate = DateTimeOffset.UtcNow;
+ var revocationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
// Act & assert
@@ -672,19 +681,20 @@ namespace Microsoft.AspNet.DataProtection.KeyManagement
// and we should've gotten a new CT.
((IInternalXmlKeyManager)keyManager).RevokeSingleKey(
keyId: new Guid("a11f35fc-1fed-4bd4-b727-056a63b70932"),
- revocationDate: new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero),
+ revocationDate: revocationDate,
reason: "Here's some reason text.");
var secondCancellationToken = keyManager.GetCacheExpirationToken();
Assert.True(firstCancellationToken.IsCancellationRequested);
Assert.False(secondCancellationToken.IsCancellationRequested);
// Was the correct element stored in the repository?
- const string expectedRepositoryXml = @"
+ var expectedRepositoryXml = string.Format(@"
- 2014-01-01T00:00:00Z
+ {0}
Here's some reason text.
- ";
+ ",
+ new XElement("revocationDate", revocationDate));
XmlAssert.Equal(expectedRepositoryXml, elementStoredInRepository);
Assert.Equal("revocation-a11f35fc-1fed-4bd4-b727-056a63b70932", friendlyNameStoredInRepository);
}
diff --git a/test/Microsoft.AspNet.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs b/test/Microsoft.AspNet.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs
index cc138e77a6..8fb3dc0d5d 100644
--- a/test/Microsoft.AspNet.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs
+++ b/test/Microsoft.AspNet.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs
@@ -5,6 +5,8 @@ using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
+using Microsoft.AspNet.DataProtection.Test.Shared;
+using Microsoft.AspNet.Testing.xunit;
using Xunit;
namespace Microsoft.AspNet.DataProtection.Managed
@@ -77,7 +79,8 @@ namespace Microsoft.AspNet.DataProtection.Managed
});
}
- [Fact]
+ [ConditionalFact]
+ [ConditionalRunTestOnlyOnWindows]
public void Encrypt_KnownKey()
{
// Arrange
diff --git a/test/Microsoft.AspNet.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs b/test/Microsoft.AspNet.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs
index 84e4d85f31..9e5a2d45a0 100644
--- a/test/Microsoft.AspNet.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs
+++ b/test/Microsoft.AspNet.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs
@@ -18,15 +18,15 @@ namespace Microsoft.AspNet.DataProtection.XmlEncryption
public void Encrypt_Decrypt_RoundTrips()
{
// Arrange
- var aes = new AesCryptoServiceProvider();
- aes.GenerateKey();
+ var symmetricAlgorithm = new TripleDESCryptoServiceProvider();
+ symmetricAlgorithm.GenerateKey();
var serviceCollection = new ServiceCollection();
var mockInternalEncryptor = new Mock();
mockInternalEncryptor.Setup(o => o.PerformEncryption(It.IsAny(), It.IsAny()))
.Returns((encryptedXml, element) =>
{
- encryptedXml.AddKeyNameMapping("theKey", aes); // use symmetric encryption
+ encryptedXml.AddKeyNameMapping("theKey", symmetricAlgorithm); // use symmetric encryption
return encryptedXml.Encrypt(element, "theKey");
});
serviceCollection.AddInstance(mockInternalEncryptor.Object);
@@ -35,7 +35,7 @@ namespace Microsoft.AspNet.DataProtection.XmlEncryption
mockInternalDecryptor.Setup(o => o.PerformPreDecryptionSetup(It.IsAny()))
.Callback(encryptedXml =>
{
- encryptedXml.AddKeyNameMapping("theKey", aes); // use symmetric encryption
+ encryptedXml.AddKeyNameMapping("theKey", symmetricAlgorithm); // use symmetric encryption
});
serviceCollection.AddInstance(mockInternalDecryptor.Object);