├── .azure └── pipelines │ ├── ci-official.yml │ ├── e2e-tests.yml │ └── fast-pr-validation.yml ├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── pull_request_template.md ├── .gitignore ├── .gitmodules ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── CONTRIBUTING.md ├── Directory.Build.props ├── Directory.Build.targets ├── LICENSE.txt ├── Microsoft.AspNetCore.sln ├── NuGet.config ├── README.md ├── THIRD-PARTY-NOTICES.txt ├── build.cmd ├── build.sh ├── build ├── AzureIntegration.targets ├── PackageArchive.targets ├── Publish.targets ├── RepositoryBuild.targets ├── SharedFx.props ├── SharedFx.targets ├── SharedFxInstaller.targets ├── artifacts.props ├── buildorder.props ├── dependencies.props ├── docker │ └── alpine.Dockerfile ├── external-dependencies.props ├── lineups │ └── Internal.AspNetCore.Universe.Lineup.nuspec ├── repo.beforecommon.props ├── repo.props ├── repo.targets ├── sources.props ├── submodules.props ├── tasks │ ├── AddMetapackageReferences.cs │ ├── CheckExpectedPackagesExist.cs │ ├── CheckVersionOverrides.cs │ ├── CreateLzma.cs │ ├── GenerateRestoreSourcesPropsFile.cs │ ├── GetDocXmlFiles.cs │ ├── JoinItems.cs │ ├── Logger │ │ ├── FlowLogger.cs │ │ └── MSBuildLogger.cs │ ├── OrderBy.cs │ ├── ProcessSharedFrameworkDeps.cs │ ├── PublishToAzureBlob.cs │ ├── RepoTasks.csproj │ ├── RepoTasks.tasks │ ├── ResolveSymbolsRecursivePath.cs │ ├── TrimDeps.cs │ ├── Utilities │ │ ├── RuntimeGraphManager.cs │ │ └── RuntimeReference.cs │ └── tasks.sln └── tools │ ├── docker │ ├── rhel.7 │ │ └── Dockerfile │ └── ubuntu.14.04 │ │ └── Dockerfile │ ├── packaging │ ├── changelog.in │ └── debian_config.json.in │ └── templates │ ├── SharedFx │ └── SharedFx.csproj │ └── SharedFxSymbols │ └── SharedFrameworkSymbols.nuspec ├── dockerbuild.sh ├── docs ├── CrossRepoBreakingChanges.md ├── PackageArchives.md ├── Submodules.md ├── build-from-source.md └── daily-builds.md ├── eng ├── AspNetCore.snk └── targets │ ├── Cpp.Common.props │ ├── Cpp.Common.targets │ ├── MicroBuild.Plugin.props │ ├── Wix.Common.props │ └── Wix.Common.targets ├── global.json ├── korebuild-lock.txt ├── korebuild.json ├── modules └── SubmoduleGraph.dgml ├── run.cmd ├── run.ps1 ├── run.sh ├── scripts ├── GenerateTags.ps1 ├── GetPackageVersion.targets ├── ListRepoVersions.ps1 ├── PatchVersionPrefix.ps1 ├── Tag-TeamCityBuild.ps1 ├── TagRepos.ps1 ├── UpdateBuildTools.ps1 ├── UpdateDependencies.ps1 ├── UpdateDependenciesCoreFx.ps1 ├── UpdateRepos.ps1 ├── UpdateSubmodules.ps1 ├── common.psm1 ├── requirements.txt └── update_travis_appveyor_yml.py ├── src ├── DataProtection │ ├── DataProtection.sln │ ├── Directory.Build.props │ ├── NuGetPackageVerifier.json │ ├── Provision-AutoGenKeys.ps1 │ ├── README.md │ ├── build.cmd │ ├── build.sh │ ├── build │ │ └── repo.props │ ├── dependencies.props │ ├── samples │ │ ├── AzureBlob │ │ │ ├── AzureBlob.csproj │ │ │ └── Program.cs │ │ ├── AzureKeyVault │ │ │ ├── AzureKeyVault.csproj │ │ │ ├── Program.cs │ │ │ └── settings.json │ │ ├── CustomEncryptorSample │ │ │ ├── CustomBuilderExtensions.cs │ │ │ ├── CustomEncryptorSample.csproj │ │ │ ├── CustomXmlDecryptor.cs │ │ │ ├── CustomXmlEncryptor.cs │ │ │ └── Program.cs │ │ ├── EntityFrameworkCoreSample │ │ │ ├── EntityFrameworkCoreSample.csproj │ │ │ └── Program.cs │ │ ├── KeyManagementSample │ │ │ ├── KeyManagementSample.csproj │ │ │ └── Program.cs │ │ ├── NonDISample │ │ │ ├── NonDISample.csproj │ │ │ └── Program.cs │ │ └── Redis │ │ │ ├── Program.cs │ │ │ └── Redis.csproj │ ├── shared │ │ ├── EncodingUtil.cs │ │ └── ExceptionExtensions.cs │ ├── src │ │ ├── Directory.Build.props │ │ ├── Microsoft.AspNetCore.Cryptography.Internal │ │ │ ├── Cng │ │ │ │ ├── BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO.cs │ │ │ │ ├── BCRYPT_KEY_LENGTHS_STRUCT.cs │ │ │ │ ├── BCryptBuffer.cs │ │ │ │ ├── BCryptBufferDesc.cs │ │ │ │ ├── BCryptEncryptFlags.cs │ │ │ │ ├── BCryptGenRandomFlags.cs │ │ │ │ ├── BCryptKeyDerivationBufferType.cs │ │ │ │ ├── BCryptUtil.cs │ │ │ │ ├── CachedAlgorithmHandles.cs │ │ │ │ ├── NCryptEncryptFlags.cs │ │ │ │ └── OSVersionUtil.cs │ │ │ ├── Constants.cs │ │ │ ├── CryptoUtil.cs │ │ │ ├── DATA_BLOB.cs │ │ │ ├── Microsoft.AspNetCore.Cryptography.Internal.csproj │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── SafeHandles │ │ │ │ ├── BCryptAlgorithmHandle.cs │ │ │ │ ├── BCryptHandle.cs │ │ │ │ ├── BCryptHashHandle.cs │ │ │ │ ├── BCryptKeyHandle.cs │ │ │ │ ├── LocalAllocHandle.cs │ │ │ │ ├── NCryptDescriptorHandle.cs │ │ │ │ ├── SafeLibraryHandle.cs │ │ │ │ └── SecureLocalAllocHandle.cs │ │ │ ├── UnsafeBufferUtil.cs │ │ │ ├── UnsafeNativeMethods.cs │ │ │ ├── WeakReferenceHelpers.cs │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.Cryptography.KeyDerivation │ │ │ ├── KeyDerivation.cs │ │ │ ├── KeyDerivationPrf.cs │ │ │ ├── Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj │ │ │ ├── PBKDF2 │ │ │ │ ├── IPbkdf2Provider.cs │ │ │ │ ├── ManagedPbkdf2Provider.cs │ │ │ │ ├── NetCorePbkdf2Provider.cs │ │ │ │ ├── Pbkdf2Util.cs │ │ │ │ ├── Win7Pbkdf2Provider.cs │ │ │ │ └── Win8Pbkdf2Provider.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.DataProtection.Abstractions │ │ │ ├── CryptoUtil.cs │ │ │ ├── DataProtectionCommonExtensions.cs │ │ │ ├── Error.cs │ │ │ ├── IDataProtectionProvider.cs │ │ │ ├── IDataProtector.cs │ │ │ ├── Infrastructure │ │ │ │ └── IApplicationDiscriminator.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.Abstractions.csproj │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.DataProtection.AzureKeyVault │ │ │ ├── AzureDataProtectionBuilderExtensions.cs │ │ │ ├── AzureKeyVaultXmlDecryptor.cs │ │ │ ├── AzureKeyVaultXmlEncryptor.cs │ │ │ ├── IKeyVaultWrappingClient.cs │ │ │ ├── KeyVaultClientWrapper.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj │ │ │ └── Properties │ │ │ │ └── AssemblyInfo.cs │ │ ├── Microsoft.AspNetCore.DataProtection.AzureStorage │ │ │ ├── AzureBlobXmlRepository.cs │ │ │ ├── AzureDataProtectionBuilderExtensions.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.AzureStorage.csproj │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.DataProtection.EntityFrameworkCore │ │ │ ├── DataProtectionKey.cs │ │ │ ├── EntityFrameworkCoreDataProtectionExtensions.cs │ │ │ ├── EntityFrameworkCoreXmlRepository.cs │ │ │ ├── IDataProtectionKeyContext.cs │ │ │ ├── LoggingExtensions.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.DataProtection.Extensions │ │ │ ├── BitHelpers.cs │ │ │ ├── DataProtectionAdvancedExtensions.cs │ │ │ ├── DataProtectionProvider.cs │ │ │ ├── ITimeLimitedDataProtector.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.Extensions.csproj │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── TimeLimitedDataProtector.cs │ │ │ └── baseline.netcore.json │ │ ├── Microsoft.AspNetCore.DataProtection.StackExchangeRedis │ │ │ ├── Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj │ │ │ ├── RedisDataProtectionBuilderExtensions.cs │ │ │ └── RedisXmlRepository.cs │ │ ├── Microsoft.AspNetCore.DataProtection.SystemWeb │ │ │ ├── CompatibilityDataProtector.cs │ │ │ ├── DataProtectionStartup.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.SystemWeb.csproj │ │ │ ├── Properties │ │ │ │ └── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── baseline.netframework.json │ │ │ └── web.config.transform │ │ └── Microsoft.AspNetCore.DataProtection │ │ │ ├── ActivatorExtensions.cs │ │ │ ├── ApplyPolicyAttribute.cs │ │ │ ├── ArraySegmentExtensions.cs │ │ │ ├── AuthenticatedEncryption │ │ │ ├── AlgorithmAssert.cs │ │ │ ├── AuthenticatedEncryptorExtensions.cs │ │ │ ├── AuthenticatedEncryptorFactory.cs │ │ │ ├── CngCbcAuthenticatedEncryptorFactory.cs │ │ │ ├── CngGcmAuthenticatedEncryptorFactory.cs │ │ │ ├── ConfigurationModel │ │ │ │ ├── AlgorithmConfiguration.cs │ │ │ │ ├── AuthenticatedEncryptorConfiguration.cs │ │ │ │ ├── AuthenticatedEncryptorDescriptor.cs │ │ │ │ ├── AuthenticatedEncryptorDescriptorDeserializer.cs │ │ │ │ ├── CngCbcAuthenticatedEncryptorConfiguration.cs │ │ │ │ ├── CngCbcAuthenticatedEncryptorDescriptor.cs │ │ │ │ ├── CngCbcAuthenticatedEncryptorDescriptorDeserializer.cs │ │ │ │ ├── CngGcmAuthenticatedEncryptorConfiguration.cs │ │ │ │ ├── CngGcmAuthenticatedEncryptorDescriptor.cs │ │ │ │ ├── CngGcmAuthenticatedEncryptorDescriptorDeserializer.cs │ │ │ │ ├── IAuthenticatedEncryptorDescriptor.cs │ │ │ │ ├── IAuthenticatedEncryptorDescriptorDeserializer.cs │ │ │ │ ├── IInternalAlgorithmConfiguration.cs │ │ │ │ ├── ManagedAuthenticatedEncryptorConfiguration.cs │ │ │ │ ├── ManagedAuthenticatedEncryptorDescriptor.cs │ │ │ │ ├── ManagedAuthenticatedEncryptorDescriptorDeserializer.cs │ │ │ │ ├── SecretExtensions.cs │ │ │ │ ├── XmlExtensions.cs │ │ │ │ └── XmlSerializedDescriptorInfo.cs │ │ │ ├── EncryptionAlgorithm.cs │ │ │ ├── IAuthenticatedEncryptor.cs │ │ │ ├── IAuthenticatedEncryptorFactory.cs │ │ │ ├── IOptimizedAuthenticatedEncryptor.cs │ │ │ ├── ManagedAuthenticatedEncryptorFactory.cs │ │ │ └── ValidationAlgorithm.cs │ │ │ ├── BitHelpers.cs │ │ │ ├── Cng │ │ │ ├── BCryptGenRandomImpl.cs │ │ │ ├── CbcAuthenticatedEncryptor.cs │ │ │ ├── DpapiSecretSerializerHelper.cs │ │ │ ├── GcmAuthenticatedEncryptor.cs │ │ │ ├── IBCryptGenRandom.cs │ │ │ └── Internal │ │ │ │ └── CngAuthenticatedEncryptorBase.cs │ │ │ ├── DataProtectionBuilderExtensions.cs │ │ │ ├── DataProtectionOptions.cs │ │ │ ├── DataProtectionServiceCollectionExtensions.cs │ │ │ ├── DataProtectionUtilityExtensions.cs │ │ │ ├── EphemeralDataProtectionProvider.cs │ │ │ ├── Error.cs │ │ │ ├── IDataProtectionBuilder.cs │ │ │ ├── IPersistedDataProtector.cs │ │ │ ├── IRegistryPolicyResolver.cs │ │ │ ├── ISecret.cs │ │ │ ├── Internal │ │ │ ├── DataProtectionBuilder.cs │ │ │ ├── DataProtectionOptionsSetup.cs │ │ │ ├── DataProtectionStartupFilter.cs │ │ │ ├── DockerUtils.cs │ │ │ ├── HostingApplicationDiscriminator.cs │ │ │ ├── IActivator.cs │ │ │ └── KeyManagementOptionsSetup.cs │ │ │ ├── KeyManagement │ │ │ ├── DefaultKeyResolver.cs │ │ │ ├── DeferredKey.cs │ │ │ ├── IKey.cs │ │ │ ├── IKeyEscrowSink.cs │ │ │ ├── IKeyManager.cs │ │ │ ├── Internal │ │ │ │ ├── CacheableKeyRing.cs │ │ │ │ ├── DefaultKeyResolution.cs │ │ │ │ ├── ICacheableKeyRingProvider.cs │ │ │ │ ├── IDefaultKeyResolver.cs │ │ │ │ ├── IInternalXmlKeyManager.cs │ │ │ │ ├── IKeyRing.cs │ │ │ │ └── IKeyRingProvider.cs │ │ │ ├── Key.cs │ │ │ ├── KeyBase.cs │ │ │ ├── KeyEscrowServiceProviderExtensions.cs │ │ │ ├── KeyExtensions.cs │ │ │ ├── KeyManagementOptions.cs │ │ │ ├── KeyRing.cs │ │ │ ├── KeyRingBasedDataProtectionProvider.cs │ │ │ ├── KeyRingBasedDataProtector.cs │ │ │ ├── KeyRingProvider.cs │ │ │ └── XmlKeyManager.cs │ │ │ ├── LoggingExtensions.cs │ │ │ ├── LoggingServiceProviderExtensions.cs │ │ │ ├── Managed │ │ │ ├── HashAlgorithmExtensions.cs │ │ │ ├── IManagedGenRandom.cs │ │ │ ├── ManagedAuthenticatedEncryptor.cs │ │ │ ├── ManagedGenRandomImpl.cs │ │ │ └── SymmetricAlgorithmExtensions.cs │ │ │ ├── MemoryProtection.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.csproj │ │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ │ │ ├── RegistryPolicy.cs │ │ │ ├── RegistryPolicyResolver.cs │ │ │ ├── Repositories │ │ │ ├── DefaultKeyStorageDirectories.cs │ │ │ ├── EphemeralXmlRepository.cs │ │ │ ├── FileSystemXmlRepository.cs │ │ │ ├── IDefaultKeyStorageDirectory.cs │ │ │ ├── IXmlRepository.cs │ │ │ └── RegistryXmlRepository.cs │ │ │ ├── Resources.resx │ │ │ ├── SP800_108 │ │ │ ├── ISP800_108_CTR_HMACSHA512Provider.cs │ │ │ ├── ManagedSP800_108_CTR_HMACSHA512.cs │ │ │ ├── SP800_108_CTR_HMACSHA512Extensions.cs │ │ │ ├── SP800_108_CTR_HMACSHA512Util.cs │ │ │ ├── Win7SP800_108_CTR_HMACSHA512Provider.cs │ │ │ └── Win8SP800_108_CTR_HMACSHA512Provider.cs │ │ │ ├── Secret.cs │ │ │ ├── SimpleActivator.cs │ │ │ ├── TypeExtensions.cs │ │ │ ├── TypeForwardingActivator.cs │ │ │ ├── XmlConstants.cs │ │ │ ├── XmlEncryption │ │ │ ├── CertificateResolver.cs │ │ │ ├── CertificateXmlEncryptor.cs │ │ │ ├── DpapiNGProtectionDescriptorFlags.cs │ │ │ ├── DpapiNGXmlDecryptor.cs │ │ │ ├── DpapiNGXmlEncryptor.cs │ │ │ ├── DpapiXmlDecryptor.cs │ │ │ ├── DpapiXmlEncryptor.cs │ │ │ ├── EncryptedXmlDecryptor.cs │ │ │ ├── EncryptedXmlInfo.cs │ │ │ ├── ICertificateResolver.cs │ │ │ ├── IInternalCertificateXmlEncryptor.cs │ │ │ ├── IInternalEncryptedXmlDecryptor.cs │ │ │ ├── IXmlDecryptor.cs │ │ │ ├── IXmlEncryptor.cs │ │ │ ├── NullXmlDecryptor.cs │ │ │ ├── NullXmlEncryptor.cs │ │ │ ├── XmlEncryptionExtensions.cs │ │ │ └── XmlKeyDecryptionOptions.cs │ │ │ ├── XmlExtensions.cs │ │ │ └── baseline.netcore.json │ ├── test │ │ ├── CreateTestCert.ps1 │ │ ├── Directory.Build.props │ │ ├── Microsoft.AspNetCore.Cryptography.Internal.Test │ │ │ ├── Cng │ │ │ │ ├── BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_Tests.cs │ │ │ │ ├── BCRYPT_KEY_LENGTHS_STRUCT_Tests.cs │ │ │ │ ├── BCryptUtilTests.cs │ │ │ │ └── CachedAlgorithmHandlesTests.cs │ │ │ ├── CryptoUtilTests.cs │ │ │ ├── Microsoft.AspNetCore.Cryptography.Internal.Test.csproj │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── SafeHandles │ │ │ │ └── SecureLocalAllocHandleTests.cs │ │ │ ├── UnsafeBufferUtilTests.cs │ │ │ └── WeakReferenceHelpersTests.cs │ │ ├── Microsoft.AspNetCore.Cryptography.KeyDerivation.Test │ │ │ ├── Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj │ │ │ ├── Pbkdf2Tests.cs │ │ │ └── Properties │ │ │ │ └── AssemblyInfo.cs │ │ ├── Microsoft.AspNetCore.DataProtection.Abstractions.Test │ │ │ ├── DataProtectionCommonExtensionsTests.cs │ │ │ └── Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj │ │ ├── Microsoft.AspNetCore.DataProtection.AzureKeyVault.Test │ │ │ ├── AzureKeyVaultXmlEncryptorTests.cs │ │ │ └── Microsoft.AspNetCore.DataProtection.AzureKeyVault.Test.csproj │ │ ├── Microsoft.AspNetCore.DataProtection.AzureStorage.Test │ │ │ ├── AzureBlobXmlRepositoryTests.cs │ │ │ ├── AzureDataProtectionBuilderExtensionsTest.cs │ │ │ └── Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj │ │ ├── Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test │ │ │ ├── DataProtectionEntityFrameworkTests.cs │ │ │ ├── DataProtectionKeyContext.cs │ │ │ ├── EntityFrameworkCoreDataProtectionBuilderExtensionsTests.cs │ │ │ └── Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj │ │ ├── Microsoft.AspNetCore.DataProtection.Extensions.Test │ │ │ ├── DataProtectionAdvancedExtensionsTests.cs │ │ │ ├── DataProtectionProviderTests.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── TestFiles │ │ │ │ ├── TestCert.pfx │ │ │ │ ├── TestCert2.pfx │ │ │ │ ├── TestCert3.pfx │ │ │ │ ├── TestCert3WithoutPrivateKey.pfx │ │ │ │ └── TestCertWithoutPrivateKey.pfx │ │ │ ├── TimeLimitedDataProtectorTests.cs │ │ │ └── X509StoreIsAvailableAttribute.cs │ │ ├── Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test │ │ │ ├── DataProtectionRedisTests.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test.csproj │ │ │ ├── RedisDataProtectionBuilderExtensionsTest.cs │ │ │ ├── TestRedisServer.cs │ │ │ ├── TestRedisServerIsAvailableAttribute.cs │ │ │ └── testconfig.json │ │ ├── Microsoft.AspNetCore.DataProtection.Test │ │ │ ├── ActivatorTests.cs │ │ │ ├── AnonymousImpersonation.cs │ │ │ ├── AuthenticatedEncryption │ │ │ │ ├── CngCbcAuthenticatedEncryptorFactoryTest.cs │ │ │ │ ├── CngGcmAuthenticatedEncryptorFactoryTest.cs │ │ │ │ ├── ConfigurationModel │ │ │ │ │ ├── AuthenticatedEncryptorDescriptorDeserializerTests.cs │ │ │ │ │ ├── AuthenticatedEncryptorDescriptorTests.cs │ │ │ │ │ ├── CngCbcAuthenticatedEncryptorConfigurationTests.cs │ │ │ │ │ ├── CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs │ │ │ │ │ ├── CngCbcAuthenticatedEncryptorDescriptorTests.cs │ │ │ │ │ ├── CngGcmAuthenticatedEncryptorConfigurationTests.cs │ │ │ │ │ ├── CngGcmAuthenticatedEncryptorDescriptorDeserializerTests.cs │ │ │ │ │ ├── CngGcmAuthenticatedEncryptorDescriptorTests.cs │ │ │ │ │ ├── ManagedAuthenticatedEncryptorConfigurationTests.cs │ │ │ │ │ ├── ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs │ │ │ │ │ └── ManagedAuthenticatedEncryptorDescriptorTests.cs │ │ │ │ └── ManagedAuthenticatedEncryptorFactoryTest.cs │ │ │ ├── Cng │ │ │ │ ├── CbcAuthenticatedEncryptorTests.cs │ │ │ │ ├── CngAuthenticatedEncryptorBaseTests.cs │ │ │ │ └── GcmAuthenticatedEncryptorTests.cs │ │ │ ├── DataProtectionUtilityExtensionsTests.cs │ │ │ ├── DockerUtilsTests.cs │ │ │ ├── EphemeralDataProtectionProviderTests.cs │ │ │ ├── HostingTests.cs │ │ │ ├── Internal │ │ │ │ └── KeyManagementOptionsSetupTest.cs │ │ │ ├── KeyManagement │ │ │ │ ├── CacheableKeyRingTests.cs │ │ │ │ ├── DefaultKeyResolverTests.cs │ │ │ │ ├── DeferredKeyTests.cs │ │ │ │ ├── KeyEscrowServiceProviderExtensionsTests.cs │ │ │ │ ├── KeyRingBasedDataProtectorTests.cs │ │ │ │ ├── KeyRingProviderTests.cs │ │ │ │ ├── KeyRingTests.cs │ │ │ │ ├── KeyTests.cs │ │ │ │ └── XmlKeyManagerTests.cs │ │ │ ├── Managed │ │ │ │ └── ManagedAuthenticatedEncryptorTests.cs │ │ │ ├── Microsoft.AspNetCore.DataProtection.Test.csproj │ │ │ ├── MockExtensions.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── RegistryPolicyResolverTests.cs │ │ │ ├── Repositories │ │ │ │ ├── EphemeralXmlRepositoryTests.cs │ │ │ │ ├── FileSystemXmlRepositoryTests.cs │ │ │ │ └── RegistryXmlRepositoryTests.cs │ │ │ ├── SP800_108 │ │ │ │ └── SP800_108Tests.cs │ │ │ ├── SecretAssert.cs │ │ │ ├── SecretTests.cs │ │ │ ├── SequentialGenRandom.cs │ │ │ ├── ServiceCollectionTests.cs │ │ │ ├── StringLoggerFactory.cs │ │ │ ├── TestFiles │ │ │ │ ├── TestCert1.PublicKeyOnly.cer │ │ │ │ ├── TestCert1.pfx │ │ │ │ └── TestCert2.pfx │ │ │ ├── TypeForwardingActivatorTests.cs │ │ │ ├── XmlAssert.cs │ │ │ └── XmlEncryption │ │ │ │ ├── CertificateXmlEncryptionTests.cs │ │ │ │ ├── DpapiNGXmlEncryptionTests.cs │ │ │ │ ├── DpapiXmlEncryptionTests.cs │ │ │ │ ├── EncryptedXmlDecryptorTests.cs │ │ │ │ ├── NullXmlEncryptionTests.cs │ │ │ │ └── XmlEncryptionExtensionsTests.cs │ │ └── shared │ │ │ ├── ConditionalRunTestOnlyWindows8OrLaterAttribute.cs │ │ │ ├── ConditionalRunTestOnlyWindowsAttribute.cs │ │ │ └── ExceptionAssert2.cs │ └── version.props ├── Installers │ ├── Debian │ │ ├── build.sh │ │ ├── package_files │ │ │ └── debian │ │ │ │ ├── compat │ │ │ │ └── source │ │ │ │ └── format │ │ ├── scripts │ │ │ ├── config_template_generator.py │ │ │ ├── debian_build_lib.sh │ │ │ ├── extract_json_value.py │ │ │ └── manpage_generator.py │ │ ├── setup │ │ │ ├── build_setup.sh │ │ │ └── test_setup.sh │ │ ├── templates │ │ │ └── debian │ │ │ │ ├── changelog │ │ │ │ ├── control │ │ │ │ ├── copyright │ │ │ │ └── rules │ │ ├── test.sh │ │ └── test │ │ │ ├── integration_tests │ │ │ └── test_package.bats │ │ │ ├── test_assets │ │ │ ├── lkgtestman.1 │ │ │ ├── test_package_layout │ │ │ │ ├── debian_config.json │ │ │ │ ├── docs.json │ │ │ │ ├── docs │ │ │ │ │ └── testdocs.1 │ │ │ │ ├── package_root │ │ │ │ │ ├── path_relative_to_package_root │ │ │ │ │ │ └── test_exe.sh │ │ │ │ │ └── test_called.sh │ │ │ │ └── samples │ │ │ │ │ └── testsample.cs │ │ │ └── testdocs.json │ │ │ └── unit_tests │ │ │ ├── test_debian_build_lib.bats │ │ │ └── test_scripts.bats │ └── Windows │ │ ├── .gitignore │ │ ├── AspNetCoreModule-Setup │ │ ├── ANCMIISExpressV1 │ │ │ ├── AncmIISExpressV1.wixproj │ │ │ └── ancm_iis_express.wxs │ │ ├── ANCMIISExpressV2 │ │ │ ├── AncmIISExpressV2.wixproj │ │ │ └── ancm_iis_expressv2.wxs │ │ ├── ANCMPackageResolver │ │ │ └── ANCMPackageResolver.csproj │ │ ├── ANCMV1 │ │ │ ├── AncmV1.wixproj │ │ │ └── aspnetcoremodule.wxs │ │ ├── ANCMV2 │ │ │ ├── AncmV2.wixproj │ │ │ └── aspnetcoremodulev2.wxs │ │ ├── CustomAction │ │ │ ├── Directory.Build.props │ │ │ ├── aspnetcoreCA.cpp │ │ │ ├── aspnetcoreCA.def │ │ │ ├── aspnetcoreCA.rc │ │ │ ├── aspnetcoreCA.vcxproj │ │ │ └── avoid_restart.cpp │ │ ├── Directory.Build.props │ │ ├── IIS-Setup │ │ │ ├── IIS-Common │ │ │ │ ├── Common.sln │ │ │ │ ├── Include │ │ │ │ │ ├── acache.h │ │ │ │ │ ├── ahutil.h │ │ │ │ │ ├── base64.hxx │ │ │ │ │ ├── buffer.h │ │ │ │ │ ├── datetime.h │ │ │ │ │ ├── dbgutil.h │ │ │ │ │ ├── debugutil.h │ │ │ │ │ ├── hashfn.h │ │ │ │ │ ├── hashtable.h │ │ │ │ │ ├── http_xp.h │ │ │ │ │ ├── httpserv_xp.h │ │ │ │ │ ├── hybrid_array.h │ │ │ │ │ ├── listentry.h │ │ │ │ │ ├── macros.h │ │ │ │ │ ├── multisz.hxx │ │ │ │ │ ├── multisza.hxx │ │ │ │ │ ├── normalize.h │ │ │ │ │ ├── ntassert.h │ │ │ │ │ ├── percpu.h │ │ │ │ │ ├── prime.h │ │ │ │ │ ├── reftrace.h │ │ │ │ │ ├── rwlock.h │ │ │ │ │ ├── statichash.h │ │ │ │ │ ├── stdtypes.h │ │ │ │ │ ├── stringa.h │ │ │ │ │ ├── stringu.h │ │ │ │ │ ├── sttimer.h │ │ │ │ │ ├── tracelog.h │ │ │ │ │ └── treehash.h │ │ │ │ ├── LICENSE │ │ │ │ ├── Managed │ │ │ │ │ ├── MySQL │ │ │ │ │ │ └── MySqlConnector.cs │ │ │ │ │ ├── NativeMethods │ │ │ │ │ │ ├── AdvApi32.cs │ │ │ │ │ │ ├── Common.cs │ │ │ │ │ │ ├── Fusion.cs │ │ │ │ │ │ ├── Kernel32.cs │ │ │ │ │ │ ├── Mlang.cs │ │ │ │ │ │ ├── User32.cs │ │ │ │ │ │ └── UxTheme.cs │ │ │ │ │ ├── PseudoLoc │ │ │ │ │ │ ├── PseudoLoc.targets │ │ │ │ │ │ └── PseudoLocalizer.cs │ │ │ │ │ ├── References │ │ │ │ │ │ └── v7Sp1 │ │ │ │ │ │ │ ├── Microsoft.Web.administration.dll │ │ │ │ │ │ │ └── Microsoft.Web.management.dll │ │ │ │ │ └── Util │ │ │ │ │ │ ├── AuthenticationModule.cs │ │ │ │ │ │ ├── ExceptionHelper.cs │ │ │ │ │ │ ├── GACManagedAccess.cs │ │ │ │ │ │ └── WebUtility.cs │ │ │ │ ├── README.md │ │ │ │ ├── UnitTests │ │ │ │ │ ├── common_tests.rc │ │ │ │ │ ├── dbgutil_tests.cpp │ │ │ │ │ ├── hash_tests.cpp │ │ │ │ │ ├── hybrid_array_tests.cpp │ │ │ │ │ ├── my_hash.h │ │ │ │ │ ├── precomp.hxx │ │ │ │ │ └── string_tests.cpp │ │ │ │ ├── lib │ │ │ │ │ ├── CommonLib.vcxproj │ │ │ │ │ ├── acache.cxx │ │ │ │ │ ├── ahutil.cpp │ │ │ │ │ ├── base64.cxx │ │ │ │ │ ├── datetime.cxx │ │ │ │ │ ├── multisz.cxx │ │ │ │ │ ├── multisza.cxx │ │ │ │ │ ├── normalize.cxx │ │ │ │ │ ├── packages.config │ │ │ │ │ ├── precomp.h │ │ │ │ │ ├── stringa.cpp │ │ │ │ │ ├── stringu.cpp │ │ │ │ │ ├── ulparse.cxx │ │ │ │ │ └── util.cxx │ │ │ │ ├── open-inc │ │ │ │ │ ├── stbuff.h │ │ │ │ │ ├── stlist.h │ │ │ │ │ ├── stlock.h │ │ │ │ │ ├── sttable.h │ │ │ │ │ └── sttimer.h │ │ │ │ ├── reftrace │ │ │ │ │ ├── include │ │ │ │ │ │ ├── dbgutil2.h │ │ │ │ │ │ ├── irtldbg.h │ │ │ │ │ │ ├── irtlmisc.h │ │ │ │ │ │ ├── memorylog.hxx │ │ │ │ │ │ ├── precomp.hxx │ │ │ │ │ │ └── pudebug.h │ │ │ │ │ ├── reftrace.vcxproj │ │ │ │ │ ├── reftrace.vcxproj.filters │ │ │ │ │ └── src │ │ │ │ │ │ ├── irtldbg.cpp │ │ │ │ │ │ ├── isplat.cxx │ │ │ │ │ │ ├── memorylog.cxx │ │ │ │ │ │ ├── pudebug.cxx │ │ │ │ │ │ ├── reftrace.c │ │ │ │ │ │ ├── tracelog.c │ │ │ │ │ │ └── win32obj.cxx │ │ │ │ └── version │ │ │ │ │ ├── bldver.h │ │ │ │ │ └── bldver.rc │ │ │ ├── IIS-Setup.sln │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── appsearch │ │ │ │ └── appsearch.wxi │ │ │ ├── iisca │ │ │ │ ├── lib │ │ │ │ │ ├── ConfigShared.cpp │ │ │ │ │ ├── ConfigShared.h │ │ │ │ │ ├── CustomAction.def │ │ │ │ │ ├── cgi_restrictions.cpp │ │ │ │ │ ├── cgi_restrictions.h │ │ │ │ │ ├── config_custom.cpp │ │ │ │ │ ├── config_custom.h │ │ │ │ │ ├── consoleprops.cpp │ │ │ │ │ ├── consoleprops.h │ │ │ │ │ ├── defaults.cpp │ │ │ │ │ ├── defaults.h │ │ │ │ │ ├── elevatedsc.cpp │ │ │ │ │ ├── elevatedsc.h │ │ │ │ │ ├── handlers.cpp │ │ │ │ │ ├── handlers.h │ │ │ │ │ ├── hotfix.cpp │ │ │ │ │ ├── httpapi.cpp │ │ │ │ │ ├── httpapi.h │ │ │ │ │ ├── iisca.cpp │ │ │ │ │ ├── iisca.h │ │ │ │ │ ├── iisca.vcxproj │ │ │ │ │ ├── iiscaexp.cpp │ │ │ │ │ ├── iiscaexp.h │ │ │ │ │ ├── modules.cpp │ │ │ │ │ ├── mof.cpp │ │ │ │ │ ├── msiutil.cpp │ │ │ │ │ ├── msiutil.h │ │ │ │ │ ├── packages.config │ │ │ │ │ ├── precomp.h │ │ │ │ │ ├── schema.cpp │ │ │ │ │ ├── secutils.cpp │ │ │ │ │ ├── secutils.h │ │ │ │ │ ├── setup_log.cpp │ │ │ │ │ ├── setup_log.h │ │ │ │ │ ├── tracing.cpp │ │ │ │ │ ├── tracing.h │ │ │ │ │ ├── uimodule.cpp │ │ │ │ │ └── wuerror.h │ │ │ │ ├── wix │ │ │ │ │ ├── iisca.wxs │ │ │ │ │ └── setupstrings.wxl │ │ │ │ └── wix3 │ │ │ │ │ ├── ElevatedShortcut.wxi │ │ │ │ │ ├── FixPatchingBehavior.wxi │ │ │ │ │ ├── HttpListener.wxi │ │ │ │ │ ├── ShortcutConsoleProperties.wxi │ │ │ │ │ ├── WindowsHotfix.wxi │ │ │ │ │ └── iisca.wxs │ │ │ ├── include.wxi │ │ │ ├── loc │ │ │ │ ├── CHS │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── CHT │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── CSY │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── DEU │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── ESN │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── FRA │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── ITA │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── JPN │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── KOR │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── PLK │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── PTB │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ ├── RUS │ │ │ │ │ └── misc │ │ │ │ │ │ └── setupstrings.wxl │ │ │ │ └── TRK │ │ │ │ │ └── misc │ │ │ │ │ └── setupstrings.wxl │ │ │ └── wcautil │ │ │ │ ├── dutil.h │ │ │ │ ├── memutil.h │ │ │ │ ├── precomp.h │ │ │ │ ├── qtexec.cpp │ │ │ │ ├── strutil.h │ │ │ │ ├── wcalog.cpp │ │ │ │ ├── wcascript.cpp │ │ │ │ ├── wcautil.cpp │ │ │ │ ├── wcautil.h │ │ │ │ └── wcawrap.cpp │ │ ├── bitmaps │ │ │ ├── AspNetCoreModule.ico │ │ │ ├── bannrbmp.bmp │ │ │ └── dlgbmp.bmp │ │ ├── build │ │ │ ├── copy-outputs.targets │ │ │ ├── exports.props │ │ │ ├── settings.props │ │ │ ├── settings │ │ │ │ ├── common.props │ │ │ │ ├── debug.props │ │ │ │ └── release.props │ │ │ ├── submodule.props │ │ │ └── versions.props │ │ ├── license │ │ │ └── license.rtf │ │ └── setupstrings.wxl │ │ ├── Directory.Build.props │ │ ├── Directory.Build.targets │ │ ├── SharedFramework │ │ ├── DependencyProvider.wxs │ │ ├── Product.props │ │ ├── Product.wxs │ │ ├── SharedFramework.wixproj │ │ └── Strings.wxl │ │ ├── SharedFrameworkBundle │ │ ├── Bundle.wxs │ │ ├── DotNetLogo.bmp │ │ ├── Product.props │ │ ├── SharedFrameworkBundle.wixproj │ │ ├── thm.wxl │ │ └── thm.xml │ │ ├── SharedFrameworkLib │ │ ├── Library.wxs │ │ └── SharedFrameworkLib.wixproj │ │ ├── WindowsHostingBundle │ │ ├── ANCM.wxs │ │ ├── Bundle.wxs │ │ ├── DotNetCore.wxs │ │ ├── DotNetLogo.bmp │ │ ├── Product.props │ │ ├── Product.targets │ │ ├── Strings.wxl │ │ ├── WindowsHostingBundle.wixproj │ │ ├── thm.wxl │ │ └── thm.xml │ │ ├── WindowsInstallers.proj │ │ ├── Wix.props │ │ ├── Wix.targets │ │ ├── build.ps1 │ │ ├── files │ │ └── eula.rtf │ │ └── tasks │ │ ├── GenerateGuid.cs │ │ ├── GetMsiProperty.cs │ │ ├── InstallerTasks.csproj │ │ └── Uuid.cs ├── PackageArchive │ ├── Archive.CiServer.Patch.Compat │ │ ├── Archive.CiServer.Patch.Compat.zipproj │ │ ├── ArchiveBaseline.2.1.1.txt │ │ ├── ArchiveBaseline.2.1.2.txt │ │ ├── ArchiveBaseline.2.1.3.txt │ │ ├── ArchiveBaseline.2.1.4.txt │ │ └── ArchiveBaseline.2.1.5.txt │ ├── Archive.CiServer.Patch │ │ ├── Archive.CiServer.Patch.zipproj │ │ ├── ArchiveBaseline.2.1.1.txt │ │ ├── ArchiveBaseline.2.1.2.txt │ │ ├── ArchiveBaseline.2.1.3.txt │ │ ├── ArchiveBaseline.2.1.4.txt │ │ └── ArchiveBaseline.2.1.5.txt │ ├── Archive.CiServer │ │ └── Archive.CiServer.zipproj │ ├── Archive.Lzma │ │ └── Archive.Lzma.lzmaproj │ ├── Archive.props │ ├── Archive.targets │ ├── Directory.Build.props │ ├── Directory.Build.targets │ ├── README.md │ ├── Scenario.ClassLibrary │ │ └── Scenario.ClassLibrary.csproj │ ├── Scenario.ConsoleApp │ │ └── Scenario.ConsoleApp.csproj │ ├── Scenario.WebApp │ │ └── Scenario.WebApp.csproj │ └── ZipManifestGenerator │ │ ├── Program.cs │ │ ├── README.md │ │ ├── ZipManifestGenerator.csproj │ │ └── ZipManifestGenerator.sln └── Packages │ ├── Directory.Build.props │ ├── Directory.Build.targets │ ├── Microsoft.AspNetCore.All │ ├── Microsoft.AspNetCore.All.csproj │ ├── build │ │ └── netcoreapp3.0 │ │ │ ├── Microsoft.AspNetCore.All.props │ │ │ └── Microsoft.AspNetCore.All.targets │ └── lib │ │ └── netcoreapp3.0 │ │ └── _._ │ ├── Microsoft.AspNetCore.Analyzers │ └── Microsoft.AspNetCore.Analyzers.csproj │ └── Microsoft.AspNetCore.App │ ├── Microsoft.AspNetCore.App.csproj │ ├── build │ └── netcoreapp3.0 │ │ ├── Microsoft.AspNetCore.App.props │ │ └── Microsoft.AspNetCore.App.targets │ └── lib │ └── netcoreapp3.0 │ └── _._ ├── test ├── Cli.FunctionalTests │ ├── AssemblyInfo.cs │ ├── Cli.FunctionalTests.csproj │ ├── Cli.FunctionalTests.sln │ ├── Directory.Build.props │ ├── Directory.Build.rsp │ ├── Directory.Build.targets │ ├── NuGet.config │ ├── NuGetPackageSource.cs │ ├── README.md │ ├── RuntimeIdentifier.cs │ ├── TemplateTests.cs │ ├── Templates │ │ ├── AngularTemplate.cs │ │ ├── ClassLibraryTemplate.cs │ │ ├── ConsoleApplicationTemplate.cs │ │ ├── MvcTemplate.cs │ │ ├── RazorApplicationBaseTemplate.cs │ │ ├── RazorBootstrapJQueryTemplate.cs │ │ ├── RazorClassLibraryTemplate.cs │ │ ├── RazorTemplate.cs │ │ ├── RazorUtil.cs │ │ ├── ReactReduxTemplate.cs │ │ ├── ReactTemplate.cs │ │ ├── SpaBaseTemplate.cs │ │ ├── Template.cs │ │ ├── TemplateType.cs │ │ ├── WebApiTemplate.cs │ │ └── WebTemplate.cs │ ├── Util │ │ ├── ConcurrentStringBuilder.cs │ │ ├── DotNetUtil.cs │ │ ├── IOUtil.cs │ │ └── ProcessHelper.cs │ ├── run-tests.ps1 │ └── test.sh └── SharedFx.UnitTests │ ├── AssertEx.cs │ ├── SharedFx.UnitTests.csproj │ ├── SharedFxTests.cs │ ├── TestData.cs │ └── TestDataAttribute.cs └── version.props /.azure/pipelines/fast-pr-validation.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - master 3 | - release/* 4 | 5 | # See https://github.com/aspnet/BuildTools 6 | resources: 7 | repositories: 8 | - repository: buildtools 9 | type: github 10 | endpoint: DotNet-Bot GitHub Connection 11 | name: aspnet/BuildTools 12 | ref: refs/heads/master 13 | 14 | phases: 15 | - template: .vsts-pipelines/templates/project-ci.yml@buildtools 16 | parameters: 17 | buildArgs: "/t:CheckUniverse" 18 | - phase: DataProtection 19 | queue: Hosted VS2017 20 | steps: 21 | - script: src/DataProtection/build.cmd -ci 22 | displayName: Run src/DataProtection/build.cmd 23 | - task: PublishTestResults@2 24 | displayName: Publish test results 25 | condition: always() 26 | inputs: 27 | testRunner: vstest 28 | testResultsFiles: 'src/DataProtection/artifacts/logs/**/*.trx' 29 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; EditorConfig to support per-solution formatting. 2 | ; Use the EditorConfig VS add-in to make this work. 3 | ; http://editorconfig.org/ 4 | 5 | ; This is the default for the codeline. 6 | root = true 7 | 8 | [*] 9 | indent_style = space 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.{cs}] 15 | indent_size = 4 16 | dotnet_sort_system_directives_first = true:warning 17 | 18 | [*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}] 19 | indent_size = 2 20 | 21 | [*.json] 22 | indent_size = 2 23 | 24 | [*.{ps1,psm1}] 25 | indent_size = 4 26 | 27 | [*.sh] 28 | indent_size = 4 29 | end_of_line = lf 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report about something that is not working 4 | --- 5 | 6 | ### Describe the bug 7 | A clear and concise description of what the bug is. 8 | 9 | ### To Reproduce 10 | Steps to reproduce the behavior: 11 | 1. Using this version of ASP.NET Core '...' 12 | 2. Run this code '....' 13 | 3. With these arguments '....' 14 | 4. See error 15 | 16 | ### Expected behavior 17 | A clear and concise description of what you expected to happen. 18 | 19 | ### Screenshots 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | ### Additional context 23 | Add any other context about the problem here. 24 | Include the output of `dotnet --info` 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | --- 5 | 6 | ### Is your feature request related to a problem? Please describe. 7 | A clear and concise description of what the problem is. 8 | Example. I'm am trying to do [...] but [...] 9 | 10 | ### Describe the solution you'd like 11 | A clear and concise description of what you want to happen. 12 | 13 | ### Describe alternatives you've considered 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | ### Additional context 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Summary of the changes (Less than 80 chars) 2 | - Detail 1 3 | - Detail 2 4 | 5 | Addresses #bugnumber (in this specific format) 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | .vs/ 4 | *.suo 5 | *.user 6 | _ReSharper.* 7 | *.DS_Store 8 | *.userprefs 9 | *.pidb 10 | *.vspx 11 | *.psess 12 | *.binlog 13 | *.log 14 | artifacts/ 15 | StyleCop.Cache 16 | node_modules/ 17 | *.snk 18 | .nuget 19 | .r 20 | .w 21 | .deps 22 | msbuild.ProjectImports.zip 23 | .env 24 | scripts/tmp/ 25 | .dotnet/ 26 | .tools/ 27 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-vscode.csharp", 4 | "ms-vscode.PowerShell", 5 | "EditorConfig.EditorConfig" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "PowerShell", 6 | "request": "launch", 7 | "name": "ps: Interactive Session", 8 | "cwd": "${workspaceRoot}" 9 | }, 10 | { 11 | "name": ".NET Core Attach", 12 | "type": "coreclr", 13 | "request": "attach", 14 | "processId": "${command:pickProcess}" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.trimTrailingWhitespace": true, 3 | "files.associations": { 4 | "*.*proj": "xml", 5 | "*.props": "xml", 6 | "*.targets": "xml", 7 | "*.tasks": "xml" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Microsoft ASP.NET Core 6 | $(MSBuildThisFileDirectory) 7 | https://github.com/aspnet/Universe 8 | git 9 | $(MSBuildThisFileDirectory)eng\AspNetCore.snk 10 | true 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | $(RepositoryRoot)artifacts\ 19 | $(ArtifactsDir)obj\ 20 | $(ArtifactsDir)$(Configuration)\ 21 | $(ArtifactsConfigurationDir)bin\ 22 | $(ArtifactsConfigurationDir)packages\ 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(MicrosoftNETCoreApp20PackageVersion) 4 | $(MicrosoftNETCoreApp21PackageVersion) 5 | $(MicrosoftNETCoreApp22PackageVersion) 6 | $(MicrosoftNETCoreApp30PackageVersion) 7 | $(NETStandardLibrary20PackageVersion) 8 | 9 | 99.9 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Universe [Archived] 2 | =================== 3 | 4 | **This GitHub project has been archived.** Ongoing development on this project can be found in . 5 | 6 | Build infrastructure used to produce the whole ASP.NET Core stack. 7 | 8 | This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [AspNetCore](https://github.com/aspnet/AspNetCore) repo. 9 | -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' default-build %*; exit $LASTEXITCODE" 3 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 5 | 6 | # Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) 7 | chmod +x "$DIR/run.sh"; sync 8 | "$DIR/run.sh" default-build "$@" 9 | -------------------------------------------------------------------------------- /build/AzureIntegration.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(MSBuildThisFileDirectory)..\modules\AzureIntegration\ 4 | 5 | 6 | 7 | 8 | 9 | AspNetUniverseBuildOffline=true; 10 | RepositoryRoot=$(AzureIntegrationProjectRoot); 11 | DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath); 12 | DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath); 13 | BuildNumber=$(BuildNumber); 14 | Configuration=$(Configuration); 15 | IsFinalBuild=$(IsFinalBuild); 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /build/docker/alpine.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.1.0-preview1-runtime-deps-alpine 2 | ARG USER 3 | ARG USER_ID 4 | ARG GROUP_ID 5 | 6 | WORKDIR /code/build 7 | RUN mkdir -p "/home/$USER" && chown "${USER_ID}:${GROUP_ID}" "/home/$USER" 8 | ENV HOME "/home/$USER" 9 | 10 | RUN apk add --no-cache \ 11 | bash \ 12 | wget \ 13 | git \ 14 | jq \ 15 | curl \ 16 | icu-libs \ 17 | openssl 18 | 19 | USER $USER_ID:$GROUP_ID 20 | 21 | # Disable the invariant mode (set in base image) 22 | ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false 23 | ENV LC_ALL en_US.UTF-8 24 | ENV LANG en_US.UTF-8 25 | 26 | # Skip package initilization 27 | ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 28 | -------------------------------------------------------------------------------- /build/lineups/Internal.AspNetCore.Universe.Lineup.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Internal.AspNetCore.Universe.Lineup 5 | $version$ 6 | Microsoft 7 | This package used to unify ASP.NET Core package versions across all Universe repos. Internal use only. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /build/repo.beforecommon.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | true 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/sources.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(DotNetAdditionalRestoreSources); 8 | $(DotNetRestoreSources); 9 | 10 | 11 | $(RestoreSources); 12 | https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json; 13 | https://api.nuget.org/v3/index.json; 14 | 15 | 16 | $(RestoreSources); 17 | https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; 18 | https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; 19 | https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json; 20 | https://dotnet.myget.org/F/roslyn/api/v3/index.json; 21 | https://vside.myget.org/F/vssdk/api/v3/index.json; 22 | https://vside.myget.org/F/vsmac/api/v3/index.json 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /build/tasks/OrderBy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Linq; 6 | using Microsoft.Build.Framework; 7 | using Microsoft.Build.Utilities; 8 | 9 | namespace RepoTasks 10 | { 11 | public class OrderBy : Task 12 | { 13 | [Required] 14 | [Output] 15 | public ITaskItem[] Items { get; set; } 16 | 17 | public string Key { get; set; } 18 | 19 | public override bool Execute() 20 | { 21 | var key = string.IsNullOrEmpty(Key) 22 | ? "Identity" 23 | : Key; 24 | Items = Items.OrderBy(k => k.GetMetadata(key)).ToArray(); 25 | return true; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /build/tasks/RepoTasks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | netcoreapp2.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /build/tasks/ResolveSymbolsRecursivePath.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.IO; 6 | using Microsoft.Build.Framework; 7 | using Microsoft.Build.Utilities; 8 | using RepoTasks.Utilities; 9 | 10 | namespace RepoTasks 11 | { 12 | public class ResolveSymbolsRecursivePath : Task 13 | { 14 | [Required] 15 | [Output] 16 | public ITaskItem[] Symbols { get; set; } 17 | 18 | public override bool Execute() 19 | { 20 | foreach (var symbol in Symbols) 21 | { 22 | var fullPath = symbol.GetMetadata("PortablePDB"); 23 | symbol.SetMetadata("SymbolsRecursivePath", fullPath.Substring(fullPath.IndexOf($"{Path.DirectorySeparatorChar}lib{Path.DirectorySeparatorChar}"))); 24 | } 25 | 26 | return true; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /build/tools/docker/rhel.7/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) .NET Foundation. All rights reserved. 3 | # Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 4 | # 5 | 6 | # Dockerfile that creates a container suitable to build dotnet-cli 7 | FROM microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-e1b4a89-20175311035359 8 | 9 | # Setup User to match Host User, and give superuser permissions 10 | ARG USER_ID=0 11 | RUN useradd -m code_executor -u ${USER_ID} -g root 12 | RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 13 | 14 | # With the User Change, we need to change permssions on these directories 15 | RUN chmod -R a+rwx /usr/local 16 | RUN chmod -R a+rwx /home 17 | RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo 18 | 19 | # Set user to the one we just created 20 | USER ${USER_ID} 21 | 22 | # Set working directory 23 | WORKDIR /opt/code 24 | -------------------------------------------------------------------------------- /build/tools/packaging/changelog.in: -------------------------------------------------------------------------------- 1 | * ${DATE} ${MAINTAINER_NAME} <${MAINTAINER_EMAIL}> - ${PACKAGE_VERSION}-${PACKAGE_REVISION} 2 | - -------------------------------------------------------------------------------- /build/tools/templates/SharedFxSymbols/SharedFrameworkSymbols.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $ID$ 5 | $VERSION$ 6 | $DESCRIPTION$ 7 | Microsoft 8 | Microsoft 9 | Copyright © Microsoft Corporation 10 | https://raw.githubusercontent.com/aspnet/Home/2.0.0/LICENSE.txt 11 | https://go.microsoft.com/fwlink/?LinkID=288859 12 | https://asp.net 13 | true 14 | true 15 | aspnetcore 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /eng/AspNetCore.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/eng/AspNetCore.snk -------------------------------------------------------------------------------- /eng/targets/Cpp.Common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /eng/targets/Cpp.Common.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /eng/targets/MicroBuild.Plugin.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MicroBuildOverridePluginDirectory) 6 | 7 | 8 | $(NuGetPackageRoot) 9 | $(NUGET_PACKAGES) 10 | $(USERPROFILE)\.nuget\packages 11 | 12 | 13 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "2.2.100-preview2-009404" 4 | }, 5 | "msbuild-sdks": { 6 | "Internal.AspNetCore.Sdk": "3.0.0-alpha1-20181011.11" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /korebuild-lock.txt: -------------------------------------------------------------------------------- 1 | version:3.0.0-alpha1-20181011.11 2 | commithash:f57aa8ddda0abdd74ada55853587bedb4f364065 3 | -------------------------------------------------------------------------------- /korebuild.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json", 3 | "channel": "master", 4 | "toolsets": { 5 | "nodejs": { 6 | "minVersion": "8.0", 7 | "required": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /run.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" 3 | -------------------------------------------------------------------------------- /scripts/GetPackageVersion.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /scripts/ListRepoVersions.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | <# 4 | .SYNOPSIS 5 | Lists the version of all submodules and this repo 6 | .PARAMETER Shipping 7 | Only list repos that are shipping 8 | #> 9 | [cmdletbinding(SupportsShouldProcess = $true)] 10 | param( 11 | [switch]$Shipping = $false 12 | ) 13 | 14 | Set-StrictMode -Version 2 15 | $ErrorActionPreference = 'Stop' 16 | 17 | Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" 18 | 19 | Assert-Git 20 | 21 | $RepoRoot = Resolve-Path "$PSScriptRoot/../" 22 | 23 | Get-Submodules $RepoRoot -Shipping:$Shipping | Format-Table -Property 'module','versionPrefix' 24 | -------------------------------------------------------------------------------- /scripts/Tag-TeamCityBuild.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | <# 4 | .SYNOPSIS 5 | Tags the given TeamCity build with the given tag. 6 | .PARAMETER BuildId 7 | The BuildId of the build to be tagged. 8 | .PARAMETER Tag 9 | The tag to put on this build. 10 | #> 11 | 12 | [cmdletbinding(SupportsShouldProcess = $true)] 13 | param( 14 | [Parameter(Mandatory = $true)] 15 | [string]$BuildId, 16 | [Parameter(Mandatory = $true)] 17 | [string]$Tag, 18 | [Parameter(Mandatory = $true)] 19 | [string]$UserName, 20 | [Parameter(Mandatory = $true)] 21 | [string]$Password 22 | ) 23 | 24 | $ErrorActionPreference = 'Stop' 25 | Set-StrictMode -Version 2 26 | 27 | $authInfo = "${UserName}:$Password" 28 | $authEncoded = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($authInfo)) 29 | $basicAuthValue = "Basic $authEncoded" 30 | 31 | $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" 32 | $headers.Add("Authorization", $basicAuthValue) 33 | $headers.Add("Content-Type", "text/plain") 34 | 35 | $uri = "http://aspnetci/app/rest/builds/$BuildId/tags/" 36 | 37 | Invoke-WebRequest -Uri $uri -Method 'POST' -Headers $headers -Body $Tag -ErrorAction SilentlyContinue 38 | -------------------------------------------------------------------------------- /scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | PyYAML==3.12 2 | termcolor==1.1.0 3 | -------------------------------------------------------------------------------- /src/DataProtection/Directory.Build.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/DataProtection/NuGetPackageVerifier.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "rules": [ 4 | "DefaultCompositeRule" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/DataProtection/README.md: -------------------------------------------------------------------------------- 1 | DataProtection 2 | ============== 3 | 4 | Data Protection APIs for protecting and unprotecting data. You can find documentation for Data Protection in the [ASP.NET Core Documentation](https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/). 5 | 6 | ## Community Maintained Data Protection Providers & Projects 7 | 8 | - [ASP.NET Core DataProtection for Service Fabric](https://github.com/MedAnd/AspNetCore.DataProtection.ServiceFabric) 9 | -------------------------------------------------------------------------------- /src/DataProtection/build.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SET RepoRoot="%~dp0..\.." 3 | %RepoRoot%\build.cmd -LockFile %RepoRoot%\korebuild-lock.txt -Path %~dp0 %* 4 | -------------------------------------------------------------------------------- /src/DataProtection/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | repo_root="$DIR/../.." 7 | "$repo_root/build.sh" --path "$DIR" --lockfile "$repo_root/korebuild-lock.txt" "$@" 8 | -------------------------------------------------------------------------------- /src/DataProtection/build/repo.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/DataProtection/samples/AzureBlob/AzureBlob.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/DataProtection/samples/AzureKeyVault/AzureKeyVault.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/DataProtection/samples/AzureKeyVault/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "CertificateThumbprint": "", 3 | "KeyId": "", 4 | "ClientId": "" 5 | } -------------------------------------------------------------------------------- /src/DataProtection/samples/CustomEncryptorSample/CustomBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.DataProtection; 6 | using Microsoft.AspNetCore.DataProtection.KeyManagement; 7 | using Microsoft.AspNetCore.DataProtection.XmlEncryption; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Options; 10 | 11 | namespace CustomEncryptorSample 12 | { 13 | public static class CustomBuilderExtensions 14 | { 15 | public static IDataProtectionBuilder UseXmlEncryptor( 16 | this IDataProtectionBuilder builder, 17 | Func factory) 18 | { 19 | builder.Services.AddSingleton>(serviceProvider => 20 | { 21 | var instance = factory(serviceProvider); 22 | return new ConfigureOptions(options => 23 | { 24 | options.XmlEncryptor = instance; 25 | }); 26 | }); 27 | 28 | return builder; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/DataProtection/samples/CustomEncryptorSample/CustomEncryptorSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net461;netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/DataProtection/samples/CustomEncryptorSample/CustomXmlDecryptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Linq; 6 | using System.Xml.Linq; 7 | using Microsoft.AspNetCore.DataProtection.XmlEncryption; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace CustomEncryptorSample 12 | { 13 | public class CustomXmlDecryptor : IXmlDecryptor 14 | { 15 | private readonly ILogger _logger; 16 | 17 | public CustomXmlDecryptor(IServiceProvider services) 18 | { 19 | _logger = services.GetRequiredService().CreateLogger(); 20 | } 21 | 22 | public XElement Decrypt(XElement encryptedElement) 23 | { 24 | if (encryptedElement == null) 25 | { 26 | throw new ArgumentNullException(nameof(encryptedElement)); 27 | } 28 | 29 | return new XElement(encryptedElement.Elements().Single()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | exe 5 | net461;netcoreapp3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/DataProtection/samples/KeyManagementSample/KeyManagementSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net461;netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/DataProtection/samples/NonDISample/NonDISample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net461;netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/DataProtection/samples/Redis/Redis.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net461;netcoreapp3.0 5 | exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/DataProtection/shared/EncodingUtil.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Text; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection 8 | { 9 | internal static class EncodingUtil 10 | { 11 | // UTF8 encoding that fails on invalid chars 12 | public static readonly UTF8Encoding SecureUtf8Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/DataProtection/shared/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection 8 | { 9 | internal static class ExceptionExtensions 10 | { 11 | /// 12 | /// Determines whether an exception must be homogenized by being wrapped inside a 13 | /// CryptographicException before being rethrown. 14 | /// 15 | public static bool RequiresHomogenization(this Exception ex) 16 | { 17 | return !(ex is CryptographicException); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptBuffer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Microsoft.AspNetCore.Cryptography.Cng 8 | { 9 | // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375368(v=vs.85).aspx 10 | [StructLayout(LayoutKind.Sequential)] 11 | internal struct BCryptBuffer 12 | { 13 | public uint cbBuffer; // Length of buffer, in bytes 14 | public BCryptKeyDerivationBufferType BufferType; // Buffer type 15 | public IntPtr pvBuffer; // Pointer to buffer 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptBufferDesc.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace Microsoft.AspNetCore.Cryptography.Cng 9 | { 10 | // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375370(v=vs.85).aspx 11 | [StructLayout(LayoutKind.Sequential)] 12 | internal unsafe struct BCryptBufferDesc 13 | { 14 | private const int BCRYPTBUFFER_VERSION = 0; 15 | 16 | public uint ulVersion; // Version number 17 | public uint cBuffers; // Number of buffers 18 | public BCryptBuffer* pBuffers; // Pointer to array of buffers 19 | 20 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 21 | public static void Initialize(ref BCryptBufferDesc bufferDesc) 22 | { 23 | bufferDesc.ulVersion = BCRYPTBUFFER_VERSION; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptEncryptFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.Cng 7 | { 8 | [Flags] 9 | internal enum BCryptEncryptFlags 10 | { 11 | BCRYPT_BLOCK_PADDING = 0x00000001, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptGenRandomFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.Cng 7 | { 8 | // from bcrypt.h 9 | [Flags] 10 | internal enum BCryptGenRandomFlags 11 | { 12 | BCRYPT_RNG_USE_ENTROPY_IN_BUFFER = 0x00000001, 13 | BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptKeyDerivationBufferType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.Cng 7 | { 8 | // from bcrypt.h 9 | internal enum BCryptKeyDerivationBufferType 10 | { 11 | KDF_HASH_ALGORITHM = 0x0, 12 | KDF_SECRET_PREPEND = 0x1, 13 | KDF_SECRET_APPEND = 0x2, 14 | KDF_HMAC_KEY = 0x3, 15 | KDF_TLS_PRF_LABEL = 0x4, 16 | KDF_TLS_PRF_SEED = 0x5, 17 | KDF_SECRET_HANDLE = 0x6, 18 | KDF_TLS_PRF_PROTOCOL = 0x7, 19 | KDF_ALGORITHMID = 0x8, 20 | KDF_PARTYUINFO = 0x9, 21 | KDF_PARTYVINFO = 0xA, 22 | KDF_SUPPPUBINFO = 0xB, 23 | KDF_SUPPPRIVINFO = 0xC, 24 | KDF_LABEL = 0xD, 25 | KDF_CONTEXT = 0xE, 26 | KDF_SALT = 0xF, 27 | KDF_ITERATION_COUNT = 0x10, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/BCryptUtil.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.Cng 7 | { 8 | /// 9 | /// Wraps utility BCRYPT APIs that don't work directly with handles. 10 | /// 11 | internal unsafe static class BCryptUtil 12 | { 13 | /// 14 | /// Fills a buffer with cryptographically secure random data. 15 | /// 16 | public static void GenRandom(byte* pbBuffer, uint cbBuffer) 17 | { 18 | if (cbBuffer != 0) 19 | { 20 | int ntstatus = UnsafeNativeMethods.BCryptGenRandom( 21 | hAlgorithm: IntPtr.Zero, 22 | pbBuffer: pbBuffer, 23 | cbBuffer: cbBuffer, 24 | dwFlags: BCryptGenRandomFlags.BCRYPT_USE_SYSTEM_PREFERRED_RNG); 25 | UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Cng/NCryptEncryptFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.Cng 7 | { 8 | [Flags] 9 | internal enum NCryptEncryptFlags 10 | { 11 | NCRYPT_NO_PADDING_FLAG = 0x00000001, 12 | NCRYPT_PAD_PKCS1_FLAG = 0x00000002, 13 | NCRYPT_PAD_OAEP_FLAG = 0x00000004, 14 | NCRYPT_PAD_PSS_FLAG = 0x00000008, 15 | NCRYPT_SILENT_FLAG = 0x00000040, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/DATA_BLOB.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Microsoft.AspNetCore.Cryptography 8 | { 9 | // http://msdn.microsoft.com/en-us/library/windows/desktop/aa381414(v=vs.85).aspx 10 | [StructLayout(LayoutKind.Sequential)] 11 | internal unsafe struct DATA_BLOB 12 | { 13 | public uint cbData; 14 | public byte* pbData; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/Microsoft.AspNetCore.Cryptography.Internal.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Infrastructure for ASP.NET Core cryptographic packages. Applications and libraries should not reference this package directly. 5 | netstandard2.0 6 | $(NoWarn);CS1591 7 | true 8 | true 9 | aspnetcore;dataprotection 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/BCryptHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Win32.SafeHandles; 6 | 7 | namespace Microsoft.AspNetCore.Cryptography.SafeHandles 8 | { 9 | internal unsafe abstract class BCryptHandle : SafeHandleZeroOrMinusOneIsInvalid 10 | { 11 | protected BCryptHandle() 12 | : base(ownsHandle: true) 13 | { 14 | } 15 | 16 | protected uint GetProperty(string pszProperty, void* pbOutput, uint cbOutput) 17 | { 18 | uint retVal; 19 | int ntstatus = UnsafeNativeMethods.BCryptGetProperty(this, pszProperty, pbOutput, cbOutput, out retVal, dwFlags: 0); 20 | UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 21 | return retVal; 22 | } 23 | 24 | protected void SetProperty(string pszProperty, void* pbInput, uint cbInput) 25 | { 26 | int ntstatus = UnsafeNativeMethods.BCryptSetProperty(this, pszProperty, pbInput, cbInput, dwFlags: 0); 27 | UnsafeNativeMethods.ThrowExceptionForBCryptStatus(ntstatus); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/LocalAllocHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | using Microsoft.Win32.SafeHandles; 7 | 8 | namespace Microsoft.AspNetCore.Cryptography.SafeHandles 9 | { 10 | /// 11 | /// Represents a handle returned by LocalAlloc. 12 | /// 13 | internal class LocalAllocHandle : SafeHandleZeroOrMinusOneIsInvalid 14 | { 15 | // Called by P/Invoke when returning SafeHandles 16 | protected LocalAllocHandle() 17 | : base(ownsHandle: true) { } 18 | 19 | // Do not provide a finalizer - SafeHandle's critical finalizer will call ReleaseHandle for you. 20 | protected override bool ReleaseHandle() 21 | { 22 | Marshal.FreeHGlobal(handle); // actually calls LocalFree 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.Internal/baseline.netcore.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssemblyIdentity": "Microsoft.AspNetCore.Cryptography.Internal, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", 3 | "Types": [] 4 | } -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/KeyDerivationPrf.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.Cryptography.KeyDerivation 5 | { 6 | /// 7 | /// Specifies the PRF which should be used for the key derivation algorithm. 8 | /// 9 | public enum KeyDerivationPrf 10 | { 11 | /// 12 | /// The HMAC algorithm (RFC 2104) using the SHA-1 hash function (FIPS 180-4). 13 | /// 14 | HMACSHA1, 15 | 16 | /// 17 | /// The HMAC algorithm (RFC 2104) using the SHA-256 hash function (FIPS 180-4). 18 | /// 19 | HMACSHA256, 20 | 21 | /// 22 | /// The HMAC algorithm (RFC 2104) using the SHA-512 hash function (FIPS 180-4). 23 | /// 24 | HMACSHA512, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ASP.NET Core utilities for key derivation. 5 | netstandard2.0;netcoreapp3.0 6 | true 7 | true 8 | aspnetcore;dataprotection 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/PBKDF2/IPbkdf2Provider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.Cryptography.KeyDerivation.PBKDF2 7 | { 8 | /// 9 | /// Internal interface used for abstracting away the PBKDF2 implementation since the implementation is OS-specific. 10 | /// 11 | internal interface IPbkdf2Provider 12 | { 13 | byte[] DeriveKey(string password, byte[] salt, KeyDerivationPrf prf, int iterationCount, int numBytesRequested); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Cryptography.KeyDerivation.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] 7 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/Error.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | using Microsoft.AspNetCore.DataProtection.Abstractions; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection 9 | { 10 | internal static class Error 11 | { 12 | public static CryptographicException CryptCommon_GenericError(Exception inner = null) 13 | { 14 | return new CryptographicException(Resources.CryptCommon_GenericError, inner); 15 | } 16 | 17 | public static CryptographicException CryptCommon_PayloadInvalid() 18 | { 19 | string message = Resources.CryptCommon_PayloadInvalid; 20 | return new CryptographicException(message); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/IDataProtectionProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.DataProtection 5 | { 6 | /// 7 | /// An interface that can be used to create instances. 8 | /// 9 | public interface IDataProtectionProvider 10 | { 11 | /// 12 | /// Creates an given a purpose. 13 | /// 14 | /// 15 | /// The purpose to be assigned to the newly-created . 16 | /// 17 | /// An IDataProtector tied to the provided purpose. 18 | /// 19 | /// The parameter must be unique for the intended use case; two 20 | /// different instances created with two different 21 | /// values will not be able to decipher each other's payloads. The parameter 22 | /// value is not intended to be kept secret. 23 | /// 24 | IDataProtector CreateProtector(string purpose); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/IDataProtector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.DataProtection 5 | { 6 | /// 7 | /// An interface that can provide data protection services. 8 | /// 9 | public interface IDataProtector : IDataProtectionProvider 10 | { 11 | /// 12 | /// Cryptographically protects a piece of plaintext data. 13 | /// 14 | /// The plaintext data to protect. 15 | /// The protected form of the plaintext data. 16 | byte[] Protect(byte[] plaintext); 17 | 18 | /// 19 | /// Cryptographically unprotects a piece of protected data. 20 | /// 21 | /// The protected data to unprotect. 22 | /// The plaintext form of the protected data. 23 | /// 24 | /// Thrown if the protected data is invalid or malformed. 25 | /// 26 | byte[] Unprotect(byte[] protectedData); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/Infrastructure/IApplicationDiscriminator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.ComponentModel; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Infrastructure 8 | { 9 | /// 10 | /// Provides information used to discriminate applications. 11 | /// 12 | /// 13 | /// This type supports the data protection system and is not intended to be used 14 | /// by consumers. 15 | /// 16 | [EditorBrowsable(EditorBrowsableState.Never)] 17 | public interface IApplicationDiscriminator 18 | { 19 | /// 20 | /// An identifier that uniquely discriminates this application from all other 21 | /// applications on the machine. 22 | /// 23 | string Discriminator { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ASP.NET Core data protection abstractions. 5 | Commonly used types: 6 | Microsoft.AspNetCore.DataProtection.IDataProtectionProvider 7 | Microsoft.AspNetCore.DataProtection.IDataProtector 8 | netstandard2.0 9 | true 10 | aspnetcore;dataprotection 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Abstractions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | // for unit testing 7 | [assembly: InternalsVisibleTo("Microsoft.AspNetCore.DataProtection.Abstractions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] 8 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault/IKeyVaultWrappingClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.Azure.KeyVault.Models; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.AzureKeyVault 8 | { 9 | internal interface IKeyVaultWrappingClient 10 | { 11 | Task UnwrapKeyAsync(string keyIdentifier, string algorithm, byte[] cipherText); 12 | Task WrapKeyAsync(string keyIdentifier, string algorithm, byte[] cipherText); 13 | } 14 | } -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault/KeyVaultClientWrapper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | using Microsoft.Azure.KeyVault; 6 | using Microsoft.Azure.KeyVault.Models; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.AzureKeyVault 9 | { 10 | internal class KeyVaultClientWrapper : IKeyVaultWrappingClient 11 | { 12 | private readonly KeyVaultClient _client; 13 | 14 | public KeyVaultClientWrapper(KeyVaultClient client) 15 | { 16 | _client = client; 17 | } 18 | 19 | public Task UnwrapKeyAsync(string keyIdentifier, string algorithm, byte[] cipherText) 20 | { 21 | return _client.UnwrapKeyAsync(keyIdentifier, algorithm, cipherText); 22 | } 23 | 24 | public Task WrapKeyAsync(string keyIdentifier, string algorithm, byte[] cipherText) 25 | { 26 | return _client.WrapKeyAsync(keyIdentifier, algorithm, cipherText); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault/Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Microsoft Azure KeyVault key encryption support. 5 | netstandard2.0 6 | true 7 | aspnetcore;dataprotection;azure;keyvault 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using System.Resources; 6 | using System.Runtime.CompilerServices; 7 | 8 | [assembly: InternalsVisibleTo("Microsoft.AspNetCore.DataProtection.AzureKeyVault.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] 9 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 10 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Microsoft Azure Blob storrage support as key store. 5 | netstandard2.0 6 | true 7 | true 8 | aspnetcore;dataprotection;azure;blob 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore/DataProtectionKey.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore 5 | { 6 | /// 7 | /// Code first model used by . 8 | /// 9 | public class DataProtectionKey 10 | { 11 | /// 12 | /// The entity identifier of the . 13 | /// 14 | public int Id { get; set; } 15 | 16 | /// 17 | /// The friendly name of the . 18 | /// 19 | public string FriendlyName { get; set; } 20 | 21 | /// 22 | /// The XML representation of the . 23 | /// 24 | public string Xml { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore/IDataProtectionKeyContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore 7 | { 8 | /// 9 | /// Interface used to store instances of in a 10 | /// 11 | public interface IDataProtectionKeyContext 12 | { 13 | /// 14 | /// A collection of 15 | /// 16 | DbSet DataProtectionKeys { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Support for storing keys using Entity Framework Core. 5 | netstandard2.0 6 | true 7 | true 8 | aspnetcore;dataprotection;entityframeworkcore 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Additional APIs for ASP.NET Core data protection. 5 | netstandard2.0 6 | true 7 | aspnetcore;dataprotection 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.Extensions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | [assembly: InternalsVisibleTo("Microsoft.AspNetCore.DataProtection.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] 7 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.StackExchangeRedis/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Support for storing data protection keys in Redis. 5 | netstandard2.0 6 | true 7 | true 8 | aspnetcore;dataprotection;redis 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element. 5 | net461 6 | $(NoWarn);CS1591 7 | true 8 | aspnet;aspnetcore;dataprotection 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection.SystemWeb/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/ApplyPolicyAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection 7 | { 8 | /// 9 | /// Signifies that the should bind this property from the registry. 10 | /// 11 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] 12 | internal sealed class ApplyPolicyAttribute : Attribute { } 13 | } 14 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/ArraySegmentExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection 7 | { 8 | internal static class ArraySegmentExtensions 9 | { 10 | public static byte[] AsStandaloneArray(this ArraySegment arraySegment) 11 | { 12 | // Fast-track: Don't need to duplicate the array. 13 | if (arraySegment.Offset == 0 && arraySegment.Count == arraySegment.Array.Length) 14 | { 15 | return arraySegment.Array; 16 | } 17 | 18 | var retVal = new byte[arraySegment.Count]; 19 | Buffer.BlockCopy(arraySegment.Array, arraySegment.Offset, retVal, 0, retVal.Length); 20 | return retVal; 21 | } 22 | 23 | public static void Validate(this ArraySegment arraySegment) 24 | { 25 | // Since ArraySegment is a struct, it can be improperly initialized or torn. 26 | // We call the ctor again to make sure the instance data is valid. 27 | var unused = new ArraySegment(arraySegment.Array, arraySegment.Offset, arraySegment.Count); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ConfigurationModel/AlgorithmConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel 7 | { 8 | public abstract class AlgorithmConfiguration 9 | { 10 | internal const int KDK_SIZE_IN_BYTES = 512 / 8; 11 | 12 | /// 13 | /// Creates a new instance based on this 14 | /// configuration. The newly-created instance contains unique key material and is distinct 15 | /// from all other descriptors created by the method. 16 | /// 17 | /// A unique . 18 | public abstract IAuthenticatedEncryptorDescriptor CreateNewDescriptor(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ConfigurationModel/IAuthenticatedEncryptorDescriptorDeserializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Xml.Linq; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel 7 | { 8 | /// 9 | /// The basic interface for deserializing an XML element into an . 10 | /// 11 | public interface IAuthenticatedEncryptorDescriptorDeserializer 12 | { 13 | /// 14 | /// Deserializes the specified XML element. 15 | /// 16 | /// The element to deserialize. 17 | /// The represented by . 18 | IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ConfigurationModel/XmlExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Xml.Linq; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel 8 | { 9 | public static class XmlExtensions 10 | { 11 | internal static bool IsMarkedAsRequiringEncryption(this XElement element) 12 | { 13 | return ((bool?)element.Attribute(XmlConstants.RequiresEncryptionAttributeName)).GetValueOrDefault(); 14 | } 15 | 16 | /// 17 | /// Marks the provided as requiring encryption before being persisted 18 | /// to storage. Use when implementing . 19 | /// 20 | public static void MarkAsRequiresEncryption(this XElement element) 21 | { 22 | if (element == null) 23 | { 24 | throw new ArgumentNullException(nameof(element)); 25 | } 26 | 27 | element.SetAttributeValue(XmlConstants.RequiresEncryptionAttributeName, true); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/IAuthenticatedEncryptorFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.DataProtection.KeyManagement; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption 8 | { 9 | public interface IAuthenticatedEncryptorFactory 10 | { 11 | /// 12 | /// Creates an instance based on the given . 13 | /// 14 | /// An instance. 15 | /// 16 | /// For a given , any two instances returned by this method should 17 | /// be considered equivalent, e.g., the payload returned by one's 18 | /// method should be consumable by the other's method. 19 | /// 20 | IAuthenticatedEncryptor CreateEncryptorInstance(IKey key); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ValidationAlgorithm.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption 7 | { 8 | /// 9 | /// Specifies a message authentication algorithm to use for providing tamper-proofing 10 | /// to protected payloads. 11 | /// 12 | public enum ValidationAlgorithm 13 | { 14 | /// 15 | /// The HMAC algorithm (RFC 2104) using the SHA-256 hash function (FIPS 180-4). 16 | /// 17 | HMACSHA256, 18 | 19 | /// 20 | /// The HMAC algorithm (RFC 2104) using the SHA-512 hash function (FIPS 180-4). 21 | /// 22 | HMACSHA512, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Cng/BCryptGenRandomImpl.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.Cryptography.Cng; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Cng 8 | { 9 | internal unsafe sealed class BCryptGenRandomImpl : IBCryptGenRandom 10 | { 11 | public static readonly BCryptGenRandomImpl Instance = new BCryptGenRandomImpl(); 12 | 13 | private BCryptGenRandomImpl() 14 | { 15 | } 16 | 17 | public void GenRandom(byte* pbBuffer, uint cbBuffer) 18 | { 19 | BCryptUtil.GenRandom(pbBuffer, cbBuffer); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Cng/IBCryptGenRandom.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.Cng 7 | { 8 | internal unsafe interface IBCryptGenRandom 9 | { 10 | void GenRandom(byte* pbBuffer, uint cbBuffer); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/DataProtectionOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection 7 | { 8 | /// 9 | /// Provides global options for the Data Protection system. 10 | /// 11 | public class DataProtectionOptions 12 | { 13 | /// 14 | /// An identifier that uniquely discriminates this application from all other 15 | /// applications on the machine. The discriminator value is implicitly included 16 | /// in all protected payloads generated by the data protection system to isolate 17 | /// multiple logical applications that all happen to be using the same key material. 18 | /// 19 | /// 20 | /// If two different applications need to share protected payloads, they should 21 | /// ensure that this property is set to the same value across both applications. 22 | /// 23 | public string ApplicationDiscriminator { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/IRegistryPolicyResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.DataProtection 5 | { 6 | // Single implementation of this interface is conditionally added to DI on Windows 7 | // We have to use interface because some DI implementations would try to activate class 8 | // even if it was not registered causing problems crossplat 9 | internal interface IRegistryPolicyResolver 10 | { 11 | RegistryPolicy ResolvePolicy(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/ISecret.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection 7 | { 8 | /// 9 | /// Represents a secret value. 10 | /// 11 | public interface ISecret : IDisposable 12 | { 13 | /// 14 | /// The length (in bytes) of the secret value. 15 | /// 16 | int Length { get; } 17 | 18 | /// 19 | /// Writes the secret value to the specified buffer. 20 | /// 21 | /// The buffer which should receive the secret value. 22 | /// 23 | /// The buffer size must exactly match the length of the secret value. 24 | /// 25 | void WriteSecretIntoBuffer(ArraySegment buffer); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Internal/DataProtectionBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Internal 8 | { 9 | /// 10 | /// Default implementation of . 11 | /// 12 | public class DataProtectionBuilder : IDataProtectionBuilder 13 | { 14 | /// 15 | /// Creates a new configuration object linked to a . 16 | /// 17 | public DataProtectionBuilder(IServiceCollection services) 18 | { 19 | if (services == null) 20 | { 21 | throw new ArgumentNullException(nameof(services)); 22 | } 23 | 24 | Services = services; 25 | } 26 | 27 | /// 28 | public IServiceCollection Services { get; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Internal/DataProtectionOptionsSetup.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Extensions.Options; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Internal 8 | { 9 | internal class DataProtectionOptionsSetup : IConfigureOptions 10 | { 11 | private readonly IServiceProvider _services; 12 | 13 | public DataProtectionOptionsSetup(IServiceProvider provider) 14 | { 15 | _services = provider; 16 | } 17 | 18 | public void Configure(DataProtectionOptions options) 19 | { 20 | options.ApplicationDiscriminator = _services.GetApplicationUniqueIdentifier(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Internal/HostingApplicationDiscriminator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.DataProtection.Infrastructure; 5 | using Microsoft.AspNetCore.Hosting; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Internal 8 | { 9 | internal class HostingApplicationDiscriminator : IApplicationDiscriminator 10 | { 11 | private readonly IHostingEnvironment _hosting; 12 | 13 | // the optional constructor for when IHostingEnvironment is not available from DI 14 | public HostingApplicationDiscriminator() 15 | { 16 | } 17 | 18 | public HostingApplicationDiscriminator(IHostingEnvironment hosting) 19 | { 20 | _hosting = hosting; 21 | } 22 | 23 | public string Discriminator => _hosting?.ContentRootPath; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Internal/IActivator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.Internal 7 | { 8 | /// 9 | /// An interface into that also supports 10 | /// limited dependency injection (of ). 11 | /// 12 | public interface IActivator 13 | { 14 | /// 15 | /// Creates an instance of and ensures 16 | /// that it is assignable to . 17 | /// 18 | object CreateInstance(Type expectedBaseType, string implementationTypeName); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/IKeyEscrowSink.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Xml.Linq; 6 | using Microsoft.AspNetCore.DataProtection.Repositories; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement 9 | { 10 | /// 11 | /// The basic interface for implementing a key escrow sink. 12 | /// 13 | /// 14 | /// is distinct from in that 15 | /// provides a write-only interface and instances handle unencrypted key material, 16 | /// while provides a read+write interface and instances handle encrypted key material. 17 | /// 18 | public interface IKeyEscrowSink 19 | { 20 | /// 21 | /// Stores the given key material to the escrow service. 22 | /// 23 | /// The id of the key being persisted to escrow. 24 | /// The unencrypted XML element that comprises the key material. 25 | void Store(Guid keyId, XElement element); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/Internal/ICacheableKeyRingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement.Internal 7 | { 8 | public interface ICacheableKeyRingProvider 9 | { 10 | CacheableKeyRing GetCacheableKeyRing(DateTimeOffset now); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/Internal/IDefaultKeyResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement.Internal 8 | { 9 | /// 10 | /// Implements policy for resolving the default key from a candidate keyring. 11 | /// 12 | public interface IDefaultKeyResolver 13 | { 14 | /// 15 | /// Locates the default key from the keyring. 16 | /// 17 | DefaultKeyResolution ResolveDefaultKeyPolicy(DateTimeOffset now, IEnumerable allKeys); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/Internal/IInternalXmlKeyManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Xml.Linq; 6 | using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement.Internal 9 | { 10 | public interface IInternalXmlKeyManager 11 | { 12 | IKey CreateNewKey(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate); 13 | 14 | IAuthenticatedEncryptorDescriptor DeserializeDescriptorFromKeyElement(XElement keyElement); 15 | 16 | void RevokeSingleKey(Guid keyId, DateTimeOffset revocationDate, string reason); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/Internal/IKeyRingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement.Internal 5 | { 6 | public interface IKeyRingProvider 7 | { 8 | IKeyRing GetCurrentKeyRing(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/KeyManagement/KeyExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.KeyManagement 7 | { 8 | internal static class KeyExtensions 9 | { 10 | public static bool IsExpired(this IKey key, DateTimeOffset now) 11 | { 12 | return (key.ExpirationDate <= now); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Managed/HashAlgorithmExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | using Microsoft.AspNetCore.Cryptography; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.Managed 9 | { 10 | internal static class HashAlgorithmExtensions 11 | { 12 | public static int GetDigestSizeInBytes(this HashAlgorithm hashAlgorithm) 13 | { 14 | var hashSizeInBits = hashAlgorithm.HashSize; 15 | CryptoUtil.Assert(hashSizeInBits >= 0 && hashSizeInBits % 8 == 0, "hashSizeInBits >= 0 && hashSizeInBits % 8 == 0"); 16 | return hashSizeInBits / 8; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Managed/IManagedGenRandom.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.Managed 7 | { 8 | internal interface IManagedGenRandom 9 | { 10 | byte[] GenRandom(int numBytes); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedGenRandomImpl.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.Managed 8 | { 9 | internal unsafe sealed class ManagedGenRandomImpl : IManagedGenRandom 10 | { 11 | private static readonly RandomNumberGenerator _rng = RandomNumberGenerator.Create(); 12 | public static readonly ManagedGenRandomImpl Instance = new ManagedGenRandomImpl(); 13 | 14 | private ManagedGenRandomImpl() 15 | { 16 | } 17 | 18 | public byte[] GenRandom(int numBytes) 19 | { 20 | var bytes = new byte[numBytes]; 21 | _rng.GetBytes(bytes); 22 | return bytes; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Managed/SymmetricAlgorithmExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | using Microsoft.AspNetCore.Cryptography; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.Managed 9 | { 10 | internal static class SymmetricAlgorithmExtensions 11 | { 12 | public static int GetBlockSizeInBytes(this SymmetricAlgorithm symmetricAlgorithm) 13 | { 14 | var blockSizeInBits = symmetricAlgorithm.BlockSize; 15 | CryptoUtil.Assert(blockSizeInBits >= 0 && blockSizeInBits % 8 == 0, "blockSizeInBits >= 0 && blockSizeInBits % 8 == 0"); 16 | return blockSizeInBits / 8; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/RegistryPolicy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel; 6 | using Microsoft.AspNetCore.DataProtection.KeyManagement; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection 9 | { 10 | internal class RegistryPolicy 11 | { 12 | public RegistryPolicy( 13 | AlgorithmConfiguration configuration, 14 | IEnumerable keyEscrowSinks, 15 | int? defaultKeyLifetime) 16 | { 17 | EncryptorConfiguration = configuration; 18 | KeyEscrowSinks = keyEscrowSinks; 19 | DefaultKeyLifetime = defaultKeyLifetime; 20 | } 21 | 22 | public AlgorithmConfiguration EncryptorConfiguration { get; } 23 | 24 | public IEnumerable KeyEscrowSinks { get; } 25 | 26 | public int? DefaultKeyLifetime { get; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/Repositories/IDefaultKeyStorageDirectory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.IO; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.Repositories 7 | { 8 | /// 9 | /// This interface enables overridding the default storage location of keys on disk 10 | /// 11 | internal interface IDefaultKeyStorageDirectories 12 | { 13 | DirectoryInfo GetKeyStorageDirectory(); 14 | 15 | DirectoryInfo GetKeyStorageDirectoryForAzureWebSites(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/SP800_108/ISP800_108_CTR_HMACSHA512Provider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.SP800_108 7 | { 8 | internal unsafe interface ISP800_108_CTR_HMACSHA512Provider : IDisposable 9 | { 10 | void DeriveKey(byte* pbLabel, uint cbLabel, byte* pbContext, uint cbContext, byte* pbDerivedKey, uint cbDerivedKey); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Security.Cryptography.X509Certificates; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.XmlEncryption 7 | { 8 | /// 9 | /// Provides services for locating instances. 10 | /// 11 | public interface ICertificateResolver 12 | { 13 | /// 14 | /// Locates an given its thumbprint. 15 | /// 16 | /// The thumbprint (as a hex string) of the certificate to resolve. 17 | /// The resolved , or null if the certificate cannot be found. 18 | X509Certificate2 ResolveCertificate(string thumbprint); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Xml; 6 | using System.Security.Cryptography.Xml; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.XmlEncryption 9 | { 10 | /// 11 | /// Internal implementation details of for unit testing. 12 | /// 13 | internal interface IInternalCertificateXmlEncryptor 14 | { 15 | EncryptedData PerformEncryption(EncryptedXml encryptedXml, XmlElement elementToEncrypt); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography.Xml; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection.XmlEncryption 8 | { 9 | /// 10 | /// Internal implementation details of for unit testing. 11 | /// 12 | internal interface IInternalEncryptedXmlDecryptor 13 | { 14 | void PerformPreDecryptionSetup(EncryptedXml encryptedXml); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IXmlDecryptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Xml.Linq; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.XmlEncryption 7 | { 8 | /// 9 | /// The basic interface for decrypting an XML element. 10 | /// 11 | public interface IXmlDecryptor 12 | { 13 | /// 14 | /// Decrypts the specified XML element. 15 | /// 16 | /// An encrypted XML element. 17 | /// The decrypted form of . 18 | /// 19 | /// Implementations of this method must not mutate the 20 | /// instance provided by . 21 | /// 22 | XElement Decrypt(XElement encryptedElement); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IXmlEncryptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Xml.Linq; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.XmlEncryption 7 | { 8 | /// 9 | /// The basic interface for encrypting XML elements. 10 | /// 11 | public interface IXmlEncryptor 12 | { 13 | /// 14 | /// Encrypts the specified . 15 | /// 16 | /// The plaintext to encrypt. 17 | /// 18 | /// An that contains the encrypted value of 19 | /// along with information about how to 20 | /// decrypt it. 21 | /// 22 | /// 23 | /// Implementations of this method must not mutate the 24 | /// instance provided by . 25 | /// 26 | EncryptedXmlInfo Encrypt(XElement plaintextElement); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/DataProtection/src/Microsoft.AspNetCore.DataProtection/XmlExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Xml.Linq; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection 8 | { 9 | /// 10 | /// Contains helpers to work with XElement objects. 11 | /// 12 | internal static class XmlExtensions 13 | { 14 | /// 15 | /// Returns a new XElement which is a carbon copy of the provided element, 16 | /// but with no child nodes. Useful for writing exception messages without 17 | /// inadvertently disclosing secret key material. It is assumed that the 18 | /// element name itself and its attribute values are not secret. 19 | /// 20 | public static XElement WithoutChildNodes(this XElement element) 21 | { 22 | var newElement = new XElement(element.Name); 23 | foreach (var attr in element.Attributes()) 24 | { 25 | newElement.SetAttributeValue(attr.Name, attr.Value); 26 | } 27 | return newElement; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DataProtection/test/CreateTestCert.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Generates a new test cert in a .pfx file 3 | # Obviously, don't actually use this to produce production certs 4 | # 5 | 6 | param( 7 | [Parameter(Mandatory = $true)] 8 | $OutFile 9 | ) 10 | 11 | $password = ConvertTo-SecureString -Force -AsPlainText -String "password" 12 | $cert = New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation Cert:\CurrentUser\My\ 13 | Export-PfxCertificate -Cert $cert -Password $password -FilePath $OutFile 14 | Remove-Item "Cert:\CurrentUser\My\$($cert.Thumbprint)" 15 | -------------------------------------------------------------------------------- /src/DataProtection/test/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | netcoreapp3.0 6 | $(DeveloperBuildTestTfms) 7 | 8 | $(StandardTestTfms);net461 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Microsoft.AspNetCore.Cryptography.Internal.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | // for unit testing 7 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 8 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.Cryptography.Internal.Test/SafeHandles/SecureLocalAllocHandleTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Xunit; 6 | 7 | namespace Microsoft.AspNetCore.Cryptography.SafeHandles 8 | { 9 | public unsafe class SecureLocalAllocHandleTests 10 | { 11 | [Fact] 12 | public void Duplicate_Copies_Data() 13 | { 14 | // Arrange 15 | const string expected = "xyz"; 16 | int cbExpected = expected.Length * sizeof(char); 17 | var controlHandle = SecureLocalAllocHandle.Allocate((IntPtr)cbExpected); 18 | for (int i = 0; i < expected.Length; i++) 19 | { 20 | ((char*)controlHandle.DangerousGetHandle())[i] = expected[i]; 21 | } 22 | 23 | // Act 24 | var duplicateHandle = controlHandle.Duplicate(); 25 | 26 | // Assert 27 | Assert.Equal(expected, new string((char*)duplicateHandle.DangerousGetHandle(), 0, expected.Length)); // contents the same data 28 | Assert.NotEqual(controlHandle.DangerousGetHandle(), duplicateHandle.DangerousGetHandle()); // shouldn't just point to the same memory location 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | // for unit testing 7 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 8 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test/DataProtectionKeyContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.EntityFrameworkCore; 5 | 6 | namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test 7 | { 8 | class DataProtectionKeyContext : DbContext, IDataProtectionKeyContext 9 | { 10 | public DataProtectionKeyContext(DbContextOptions options) : base(options) { } 11 | 12 | public DbSet DataProtectionKeys { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Xunit; 5 | 6 | // Workaround for DataProtectionProviderTests.System_UsesProvidedDirectoryAndCertificate 7 | // https://github.com/aspnet/DataProtection/issues/160 8 | [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert2.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert2.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert3.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert3.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert3WithoutPrivateKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCert3WithoutPrivateKey.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCertWithoutPrivateKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/TestFiles/TestCertWithoutPrivateKey.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test/RedisDataProtectionBuilderExtensionsTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.DataProtection.KeyManagement; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Microsoft.Extensions.Options; 7 | using Moq; 8 | using StackExchange.Redis; 9 | using Xunit; 10 | 11 | namespace Microsoft.AspNetCore.DataProtection.StackExchangeRedis 12 | { 13 | public class RedisDataProtectionBuilderExtensionsTest 14 | { 15 | [Fact] 16 | public void PersistKeysToRedis_UsesRedisXmlRepository() 17 | { 18 | // Arrange 19 | var connection = Mock.Of(); 20 | var serviceCollection = new ServiceCollection(); 21 | var builder = serviceCollection.AddDataProtection(); 22 | 23 | // Act 24 | builder.PersistKeysToStackExchangeRedis(connection); 25 | var services = serviceCollection.BuildServiceProvider(); 26 | 27 | // Assert 28 | var options = services.GetRequiredService>(); 29 | Assert.IsType(options.Value.XmlRepository); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test/TestRedisServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.Configuration; 5 | using System; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection 8 | { 9 | internal class TestRedisServer 10 | { 11 | public const string ConnectionStringKeyName = "Test:Redis:Server"; 12 | private static readonly IConfigurationRoot _config; 13 | 14 | static TestRedisServer() 15 | { 16 | _config = new ConfigurationBuilder() 17 | .SetBasePath(AppContext.BaseDirectory) 18 | .AddJsonFile("testconfig.json") 19 | .AddEnvironmentVariables() 20 | .Build(); 21 | } 22 | 23 | internal static string GetConnectionString() 24 | { 25 | return _config[ConnectionStringKeyName]; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test/TestRedisServerIsAvailableAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Testing.xunit; 5 | using System; 6 | 7 | namespace Microsoft.AspNetCore.DataProtection 8 | { 9 | internal class TestRedisServerIsAvailableAttribute : Attribute, ITestCondition 10 | { 11 | public bool IsMet => !string.IsNullOrEmpty(TestRedisServer.GetConnectionString()); 12 | 13 | public string SkipReason => $"A test redis server must be configured to run. Set the connection string as an environment variable as {TestRedisServer.ConnectionStringKeyName.Replace(":", "__")} or in testconfig.json"; 14 | } 15 | } -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Test/testconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "Test": { 3 | "Redis": { 4 | // You can setup a local Redis server easily with Docker by running 5 | // docker run --rm -it -p 6379:6379 redis 6 | // Then uncomment this config below 7 | // "Server": "localhost:6379,127.0.0.1:6379" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/Microsoft.AspNetCore.DataProtection.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(StandardTestTfms) 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | // for unit testing 7 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] 8 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/SequentialGenRandom.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.DataProtection.Cng; 6 | using Microsoft.AspNetCore.DataProtection.Managed; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection 9 | { 10 | internal unsafe class SequentialGenRandom : IBCryptGenRandom, IManagedGenRandom 11 | { 12 | private byte _value; 13 | 14 | public byte[] GenRandom(int numBytes) 15 | { 16 | byte[] bytes = new byte[numBytes]; 17 | for (int i = 0; i < bytes.Length; i++) 18 | { 19 | bytes[i] = _value++; 20 | } 21 | return bytes; 22 | } 23 | 24 | public void GenRandom(byte* pbBuffer, uint cbBuffer) 25 | { 26 | for (uint i = 0; i < cbBuffer; i++) 27 | { 28 | pbBuffer[i] = _value++; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert1.PublicKeyOnly.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert1.PublicKeyOnly.cer -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert1.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert1.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert2.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/DataProtection/test/Microsoft.AspNetCore.DataProtection.Test/TestFiles/TestCert2.pfx -------------------------------------------------------------------------------- /src/DataProtection/test/shared/ConditionalRunTestOnlyWindows8OrLaterAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.Cryptography.Cng; 6 | using Microsoft.AspNetCore.Testing.xunit; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.Test.Shared 9 | { 10 | public class ConditionalRunTestOnlyOnWindows8OrLaterAttribute : Attribute, ITestCondition 11 | { 12 | public bool IsMet => OSVersionUtil.IsWindows8OrLater(); 13 | 14 | public string SkipReason { get; } = "Test requires Windows 8 / Windows Server 2012 or higher."; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/DataProtection/test/shared/ConditionalRunTestOnlyWindowsAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.AspNetCore.Cryptography.Cng; 6 | using Microsoft.AspNetCore.Testing.xunit; 7 | 8 | namespace Microsoft.AspNetCore.DataProtection.Test.Shared 9 | { 10 | public class ConditionalRunTestOnlyOnWindowsAttribute : Attribute, ITestCondition 11 | { 12 | public bool IsMet => OSVersionUtil.IsWindows(); 13 | 14 | public string SkipReason { get; } = "Test requires Windows 7 / Windows Server 2008 R2 or higher."; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/DataProtection/test/shared/ExceptionAssert2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Security.Cryptography; 6 | using Xunit; 7 | 8 | namespace Microsoft.AspNetCore.Testing 9 | { 10 | internal static class ExceptionAssert2 11 | { 12 | /// 13 | /// Verifies that the code throws a . 14 | /// 15 | /// A delegate to the code to be tested 16 | /// The that was thrown, when successful 17 | /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown 18 | public static CryptographicException ThrowsCryptographicException(Action testCode) 19 | { 20 | return Assert.Throws(testCode); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DataProtection/version.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 3.0.0 4 | alpha1 5 | $(VersionPrefix) 6 | $(VersionPrefix)-$(VersionSuffix)-final 7 | t000 8 | a- 9 | $(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) 10 | $(VersionSuffix)-$(BuildNumber) 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Installers/Debian/package_files/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /src/Installers/Debian/package_files/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /src/Installers/Debian/setup/build_setup.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | install_dependencies(){ 7 | # Add LLdb 3.6 package source 8 | echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list 9 | wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - 10 | 11 | #Install Deps 12 | apt-get update 13 | apt-get install -y debhelper build-essential devscripts git liblttng-ust-dev lldb-3.6-dev 14 | } 15 | 16 | setup(){ 17 | install_dependencies 18 | } 19 | 20 | setup -------------------------------------------------------------------------------- /src/Installers/Debian/setup/test_setup.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | install_dependencies(){ 7 | # Add LLdb 3.6 package source 8 | echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list 9 | wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - 10 | 11 | #Install Deps 12 | apt-get update 13 | apt-get install -y debhelper build-essential devscripts git liblttng-ust-dev lldb-3.6-dev 14 | } 15 | 16 | install_bats(){ 17 | git clone https://github.com/sstephenson/bats.git 18 | cd bats 19 | ./install.sh /usr/local 20 | } 21 | 22 | setup(){ 23 | install_dependencies 24 | install_bats 25 | } 26 | 27 | setup -------------------------------------------------------------------------------- /src/Installers/Debian/templates/debian/changelog: -------------------------------------------------------------------------------- 1 | {PACKAGE_NAME} ({PACKAGE_VERSION}-{PACKAGE_REVISION}) unstable; urgency={URGENCY} 2 | 3 | * {CHANGELOG_MESSAGE} 4 | 5 | -- {MAINTAINER_NAME} <{MAINTAINER_EMAIL}> {DATE} 6 | -------------------------------------------------------------------------------- /src/Installers/Debian/templates/debian/control: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | Source: {PACKAGE_NAME} 7 | Maintainer: {MAINTAINER_NAME} <{MAINTAINER_EMAIL}> 8 | Section: {SECTION} 9 | Priority: {PRIORITY} 10 | Standards-Version: 3.9.2 11 | Build-Depends: debhelper (>=9) 12 | Homepage: {HOMEPAGE} 13 | 14 | Package: {PACKAGE_NAME} 15 | Architecture: {ARCH} 16 | Depends: ${{shlibs:Depends}}, ${{misc:Depends}}{DEPENDENT_PACKAGES} 17 | Conflicts: {CONFLICT_PACKAGES} 18 | Description: {SHORT_DESCRIPTION} 19 | {LONG_DESCRIPTION} 20 | -------------------------------------------------------------------------------- /src/Installers/Debian/templates/debian/copyright: -------------------------------------------------------------------------------- 1 | Comment: Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information. 2 | 3 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 4 | 5 | Files: * 6 | Copyright: {COPYRIGHT_TEXT} 7 | License: {LICENSE_NAME} 8 | 9 | License: {LICENSE_NAME} 10 | {LICENSE_TEXT} -------------------------------------------------------------------------------- /src/Installers/Debian/templates/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # 3 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 4 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | # 6 | 7 | {overrides} 8 | 9 | %: 10 | dh $@ 11 | 12 | -------------------------------------------------------------------------------- /src/Installers/Debian/test.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | 8 | current_user=$(whoami) 9 | if [ $current_user != "root" ]; then 10 | echo "test.sh requires superuser privileges to run" 11 | exit 1 12 | fi 13 | 14 | run_unit_tests(){ 15 | bats $DIR/test/unit_tests/test_debian_build_lib.bats 16 | bats $DIR/test/unit_tests/test_scripts.bats 17 | } 18 | 19 | run_integration_tests(){ 20 | input_dir=$DIR/test/test_assets/test_package_layout 21 | output_dir=$DIR/bin 22 | 23 | # Create output dir 24 | mkdir -p $output_dir 25 | 26 | # Build the actual package 27 | $DIR/package_tool -i $input_dir -o $output_dir 28 | 29 | # Integration Test Entrypoint placed by package_tool 30 | bats $output_dir/test_package.bats 31 | 32 | # Cleanup output dir 33 | rm -rf $DIR/test/test_assets/test_package_output 34 | } 35 | 36 | run_all(){ 37 | run_unit_tests 38 | run_integration_tests 39 | } 40 | 41 | run_all 42 | -------------------------------------------------------------------------------- /src/Installers/Debian/test/test_assets/test_package_layout/package_root/path_relative_to_package_root/test_exe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 4 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | # 6 | 7 | # Resolve symlinks until we have the parent dir of the actual file 8 | SOURCE="${BASH_SOURCE[0]}" 9 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 10 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 11 | SOURCE="$(readlink "$SOURCE")" 12 | [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 13 | done 14 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 15 | 16 | # This is how tools should be called 17 | exec bash $DIR/../test_called.sh 18 | -------------------------------------------------------------------------------- /src/Installers/Debian/test/test_assets/test_package_layout/package_root/test_called.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 4 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | # 6 | 7 | echo "script called" 8 | -------------------------------------------------------------------------------- /src/Installers/Debian/test/test_assets/test_package_layout/samples/testsample.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | public class Program { 7 | 8 | public static void Main(){ 9 | System.Console.WriteLine("Hello World"); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /src/Installers/Debian/test/unit_tests/test_scripts.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | # 3 | # Copyright (c) .NET Foundation and contributors. All rights reserved. 4 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | # 6 | 7 | # Tests for debian_build_lib.sh 8 | 9 | setup(){ 10 | DIR="$BATS_TEST_DIRNAME" 11 | PACKAGIFY_DIR="$(readlink -f $DIR/../../)" 12 | } 13 | 14 | @test "manpage generation is identical to lkg file" { 15 | # Output is file "tool1.1" 16 | # LKG file is "lkgtestman.1" 17 | python $PACKAGIFY_DIR/scripts/manpage_generator.py $PACKAGIFY_DIR/test/test_assets/testdocs.json $PACKAGIFY_DIR/test/test_assets 18 | 19 | # Test Output existence 20 | [ -f $PACKAGIFY_DIR/test/test_assets/tool1.1 ] 21 | 22 | # Test Output matches LKG 23 | # If this is failing double check line ending style 24 | [ -z "$(diff "$PACKAGIFY_DIR/test/test_assets/tool1.1" "$PACKAGIFY_DIR/test/test_assets/lkgtestman.1")" ] 25 | 26 | # Cleanup 27 | rm $PACKAGIFY_DIR/test/test_assets/tool1.1 28 | } -------------------------------------------------------------------------------- /src/Installers/Windows/.gitignore: -------------------------------------------------------------------------------- 1 | ancm/ 2 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/ANCMPackageResolver/ANCMPackageResolver.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard1.0 4 | true 5 | true 6 | $(RepositoryRoot).deps\ANCM 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | $(RepositoryRoot).deps\ANCM; 17 | 18 | 19 | $(RestoreSources); 20 | https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json; 21 | https://api.nuget.org/v3/index.json; 22 | https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(_TwoDigitYear)$(_ThreeDigitDayOfYear) 8 | $(PRODUCT_MAJOR) 9 | $(PRODUCT_MINOR) 10 | $(BUILD_MAJOR) 11 | $(BUILD_MINOR) 12 | BLDVERMAJOR=$(BLDVERMAJOR);BLDVERMINOR=$(BLDVERMINOR);BLDNUMMAJOR=$(BLDNUMMAJOR);BLDNUMMINOR=$(BLDNUMMINOR);$(DefineConstants) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def: -------------------------------------------------------------------------------- 1 | LIBRARY aspnetcoreCA 2 | 3 | EXPORTS 4 | 5 | ; IIS Common Config custom actions 6 | 7 | IISScheduleInstallCA 8 | IISScheduleUninstallCA 9 | IISExecuteCA 10 | IISBeginTransactionCA 11 | IISRollbackTransactionCA 12 | IISCommitTransactionCA 13 | 14 | CheckForSharedConfigurationCA 15 | 16 | ScheduleInstallWindowsHotfixCA 17 | ExecuteInstallWindowsHotfixCA 18 | ExecuteCleanUpWindowsHotfixCA 19 | ScheduleRebootIfRequiredCA 20 | 21 | RegisterANCMCompressionCA 22 | 23 | CheckForServicesRunningCA 24 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.rc: -------------------------------------------------------------------------------- 1 | #define VER_FILETYPE VFT_DLL 2 | #define RC_VERSION_INTERNAL_NAME "aspnetcoreCA\0" 3 | #define RC_VERSION_ORIGINAL_FILE_NAME "aspnetcoreCA.dll\0" 4 | #define RC_VERSION_FILE_DESCRIPTION "IIS AspNet Core Support Module Custom Action DLL\0" 5 | #define PRODUCT_MAJOR 7 6 | #define PRODUCT_MINOR 1 7 | #define BUILD_MAJOR 1972 8 | #define BUILD_MINOR 0 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Include/datetime.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #ifndef _DATETIME_H_ 5 | #define _DATETIME_H_ 6 | 7 | BOOL 8 | StringTimeToFileTime( 9 | PCSTR pszTime, 10 | ULONGLONG * pulTime 11 | ); 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Include/normalize.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #ifndef __NORMALIZE_URL__H__ 5 | #define __NORMALIZE_URL__H__ 6 | 7 | HRESULT 8 | NormalizeUrl( 9 | __inout LPSTR pszUrl 10 | ); 11 | 12 | 13 | HRESULT 14 | NormalizeUrlW( 15 | __inout LPWSTR pszUrl 16 | ); 17 | 18 | 19 | 20 | HRESULT 21 | UlCleanAndCopyUrl( 22 | __in LPSTR pSource, 23 | IN ULONG SourceLength, 24 | OUT PULONG pBytesCopied, 25 | __inout PWSTR pDestination, 26 | __deref_opt_out_opt PWSTR * ppQueryString OPTIONAL 27 | ); 28 | 29 | HRESULT 30 | UlInitializeParsing( 31 | VOID 32 | ); 33 | 34 | HRESULT 35 | InitializeNormalizeUrl( 36 | VOID 37 | ); 38 | 39 | 40 | #endif -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Include/stdtypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | // 7 | // Use C++ standard 'nullptr' 8 | // 9 | 10 | #ifdef NULL 11 | #undef NULL 12 | #endif 13 | 14 | #ifdef __cplusplus 15 | #ifdef _NATIVE_NULLPTR_SUPPORTED 16 | #define NULL nullptr 17 | #else 18 | #define NULL 0 19 | #define nullptr 0 20 | #endif 21 | #else 22 | #define NULL ((void *)0) 23 | //#define nullptr ((void *)0) 24 | #endif 25 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/MySQL/MySqlConnector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Web.Utility 7 | { 8 | internal static class MySqlConnector 9 | { 10 | public static string[] HardCodedAssemblyVersions 11 | { 12 | get 13 | { 14 | return new string[] 15 | { 16 | "MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 17 | "MySql.Data, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 18 | "MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 19 | "MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 20 | "MySql.Data, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 21 | "MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 22 | "MySql.Data, Version=5.2.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 23 | "MySql.Data, Version=5.2.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d", 24 | }; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/PseudoLoc/PseudoLoc.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/References/v7Sp1/Microsoft.Web.administration.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/References/v7Sp1/Microsoft.Web.administration.dll -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/References/v7Sp1/Microsoft.Web.management.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/Managed/References/v7Sp1/Microsoft.Web.management.dll -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/README.md: -------------------------------------------------------------------------------- 1 | Microsoft IIS Common 2 | -------------------------------- 3 | 4 | The repository contains common resources shared by IIS Out-Of-Band (OOB) products. 5 | 6 | ### Contributing 7 | 8 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 9 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 10 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 11 | 12 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 13 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 14 | provided by the bot. You will only need to do this once across all repos using our CLA. 15 | 16 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 17 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 18 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 19 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/UnitTests/common_tests.rc: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #define RC_VERSION_INTERNAL_NAME "Common.UnitTests\0" 5 | #define RC_VERSION_ORIGINAL_FILE_NAME "Common.UnitTests.dll\0" 6 | #define RC_VERSION_FILE_DESCRIPTION "Common.UnitTests0" 7 | #include 8 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/UnitTests/my_hash.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | class MY_OBJ 7 | { 8 | public: 9 | MY_OBJ(PCWSTR pstr) 10 | : _pstr(pstr) 11 | {} 12 | 13 | PCWSTR GetString() 14 | { 15 | return _pstr; 16 | } 17 | 18 | private: 19 | PCWSTR _pstr; 20 | }; 21 | 22 | class MY_HASH : public HASH_TABLE 23 | { 24 | public: 25 | VOID 26 | ReferenceRecord( 27 | MY_OBJ * //pRecord 28 | ) 29 | {} 30 | 31 | VOID 32 | DereferenceRecord( 33 | MY_OBJ * //pRecord 34 | ) 35 | {} 36 | 37 | PCWSTR 38 | ExtractKey( 39 | MY_OBJ * pRecord 40 | ) 41 | { 42 | return pRecord->GetString(); 43 | } 44 | 45 | DWORD 46 | CalcKeyHash( 47 | PCWSTR key 48 | ) 49 | { 50 | return HashString(key); 51 | } 52 | 53 | BOOL 54 | EqualKeys( 55 | PCWSTR key1, 56 | PCWSTR key2 57 | ) 58 | { 59 | return (wcscmp(key1, key2) == 0); 60 | } 61 | }; 62 | 63 | void TestHash(); -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/UnitTests/precomp.hxx: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | // Native-only by default 6 | #pragma unmanaged 7 | #include 8 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/lib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/lib/precomp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #include 5 | #include 6 | #pragma warning( disable:4127 ) 7 | #include 8 | #include 9 | #include 10 | 11 | #include "macros.h" 12 | #include "stringu.h" 13 | #include "stringa.h" 14 | #include "dbgutil.h" 15 | #include "ntassert.h" 16 | #include "ahutil.h" 17 | #include "acache.h" 18 | #include "base64.hxx" 19 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/IIS-Common/reftrace/include/precomp.hxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tchar.h" 3 | #include "dbgutil.h" 4 | #include "ntassert.h" 5 | #include "buffer.h" 6 | #include "stringa.h" 7 | #include "stringu.h" 8 | #include "stdlib.h" 9 | #include "stdio.h" 10 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/README.md: -------------------------------------------------------------------------------- 1 | Microsoft IIS Setup 2 | -------------------------------- 3 | 4 | The repository contains setup resources shared by IIS Out-Of-Band (OOB) products. 5 | 6 | ### Contributing 7 | 8 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 9 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 10 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 11 | 12 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 13 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 14 | provided by the bot. You will only need to do this once across all repos using our CLA. 15 | 16 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 17 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 18 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 19 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/ConfigShared.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | HRESULT 5 | CheckInstallToSharedConfig( 6 | IN MSIHANDLE hInstall, 7 | BOOL * pbShouldInstall 8 | ); 9 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/CustomAction.def: -------------------------------------------------------------------------------- 1 | ; Copyright (c) Microsoft Corporation. All rights reserved. 2 | ; Licensed under the MIT license. 3 | 4 | LIBRARY iisca 5 | 6 | EXPORTS 7 | 8 | ; IIS Common Config custom actions 9 | 10 | IISScheduleInstallCA 11 | IISScheduleUninstallCA 12 | IISExecuteCA 13 | IISBeginTransactionCA 14 | IISRollbackTransactionCA 15 | IISCommitTransactionCA 16 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/cgi_restrictions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | 5 | #ifndef _CGI_RESTRICTIONS_H_ 6 | #define _CGI_RESTRICTIONS_H_ 7 | 8 | 9 | HRESULT 10 | RegisterCgiRestriction( 11 | IN IAppHostAdminManager * pAdminMgr, 12 | IN CONST WCHAR * szConfigPath, 13 | IN CONST WCHAR * szPath, 14 | IN BOOL fAllowed, 15 | IN OPTIONAL CONST WCHAR * szGroupId, 16 | IN OPTIONAL CONST WCHAR * szDescription 17 | ); 18 | 19 | 20 | HRESULT 21 | UnRegisterCgiRestriction( 22 | IN IAppHostAdminManager * pAdminMgr, 23 | IN CONST WCHAR * szConfigPath, 24 | IN CONST WCHAR * szPath, 25 | IN BOOL fExpandPath = FALSE 26 | ); 27 | 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/config_custom.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | 5 | #ifndef _CONFIG_CUSTOM_H_ 6 | #define _CONFIG_CUSTOM_H_ 7 | 8 | 9 | UINT 10 | __stdcall 11 | CheckForSharedConfigurationCA( 12 | MSIHANDLE hInstall 13 | ); 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/consoleprops.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | UINT 7 | WINAPI 8 | ScheduleSetConsolePropertiesCA( 9 | IN MSIHANDLE hInstall 10 | ); 11 | 12 | UINT 13 | WINAPI 14 | ExecuteSetConsolePropertiesCA( 15 | IN MSIHANDLE hInstall 16 | ); -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/elevatedsc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | UINT 7 | WINAPI 8 | ScheduleMakeShortcutElevatedCA( 9 | IN MSIHANDLE hInstall 10 | ); 11 | 12 | UINT 13 | WINAPI 14 | ExecuteMakeShortcutElevatedCA( 15 | IN MSIHANDLE hInstall 16 | ); -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/httpapi.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | 7 | enum IIS_HTTP_LISTENER_CA_TYPE 8 | { 9 | IIS_HTTP_LISTENER_CA_INSTALL, 10 | IIS_HTTP_LISTENER_CA_UNINSTALL 11 | }; 12 | 13 | HRESULT GetSidStringForAccount( 14 | const WCHAR * szAccount, 15 | __inout STRU * pstr 16 | ); 17 | 18 | UINT 19 | WINAPI 20 | ScheduleHttpListenerCA( 21 | IN MSIHANDLE hInstall, 22 | IN const WCHAR * pszCAName, 23 | IIS_HTTP_LISTENER_CA_TYPE caType 24 | ); 25 | 26 | UINT 27 | __stdcall 28 | ExecuteHttpListenerCA( 29 | IN MSIHANDLE hInstall, 30 | IIS_HTTP_LISTENER_CA_TYPE caType 31 | ); 32 | 33 | UINT 34 | WINAPI 35 | ScheduleInstallHttpListenerCA( 36 | IN MSIHANDLE hInstall 37 | ); 38 | 39 | UINT 40 | __stdcall 41 | ExecuteInstallHttpListenerCA( 42 | IN MSIHANDLE hInstall 43 | ); 44 | 45 | UINT 46 | WINAPI 47 | ScheduleUnInstallHttpListenerCA( 48 | IN MSIHANDLE hInstall 49 | ); 50 | 51 | UINT 52 | __stdcall 53 | ExecuteUnInstallHttpListenerCA( 54 | IN MSIHANDLE hInstall 55 | ); -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/iiscaexp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | UINT 5 | WINAPI 6 | IISScheduleInstallCA( 7 | IN MSIHANDLE hInstall 8 | ); 9 | 10 | UINT 11 | WINAPI 12 | IISScheduleUninstallCA( 13 | IN MSIHANDLE hInstall 14 | ); 15 | 16 | UINT 17 | WINAPI 18 | IISExecuteCA( 19 | IN MSIHANDLE hInstall 20 | ); 21 | 22 | UINT 23 | WINAPI 24 | IISBeginTransactionCA( 25 | IN MSIHANDLE hInstall 26 | ); 27 | 28 | UINT 29 | WINAPI 30 | IISRollbackTransactionCA( 31 | IN MSIHANDLE hInstall 32 | ); 33 | 34 | UINT 35 | WINAPI 36 | IISCommitTransactionCA( 37 | IN MSIHANDLE hInstall 38 | ); 39 | 40 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/precomp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | // Don't throw exceptions for CComVariant failures. 7 | // Check for VT_ERROR instead. 8 | #define _ATL_NO_VARIANT_THROW 9 | #define WIN32_LEAN_AND_MEAN 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #pragma warning( disable:4127 ) 16 | #include 17 | #include "dbgutil.h" 18 | #include 19 | #define IRTL_DLLEXP 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | // 29 | // Security APIs. 30 | // 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | #include "ahutil.h" 38 | #include "msiutil.h" 39 | #include "defaults.h" 40 | #include "cgi_restrictions.h" 41 | #include "handlers.h" 42 | #include "tracing.h" 43 | #include "config_custom.h" 44 | #include "setup_log.h" 45 | #include "httpapi.h" 46 | #include "secutils.h" 47 | #include "ConfigShared.h" 48 | #include "iisca.h" 49 | #include "iiscaexp.h" 50 | extern HINSTANCE g_hinst; 51 | 52 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/setup_log.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #ifndef _SETUP_LOG_H_ 5 | #define _SETUP_LOG_H_ 6 | 7 | 8 | // 9 | // Severity levels for setup log information. This is arranged in the 10 | // order of increasing severity. 11 | // 12 | enum SETUP_LOG_SEVERITY 13 | { 14 | SETUP_LOG_SEVERITY_DEBUG, 15 | SETUP_LOG_SEVERITY_INFORMATION, 16 | SETUP_LOG_SEVERITY_WARNING, 17 | SETUP_LOG_SEVERITY_ERROR 18 | }; 19 | 20 | //consider using an IIS prefix for Msi* methods - they conflict with MSI apis 21 | 22 | // 23 | // Initalize logging once at begining of CA 24 | // 25 | 26 | VOID 27 | IISLogInitialize( 28 | IN MSIHANDLE hInstall, 29 | IN LPCWSTR pszCAName 30 | ); 31 | 32 | // 33 | // Close logging at end / exit of CA 34 | // 35 | 36 | VOID 37 | IISLogClose( 38 | VOID 39 | ); 40 | 41 | // 42 | // Writes a message to msi log file 43 | // 44 | VOID 45 | IISLogWrite( 46 | IN SETUP_LOG_SEVERITY setupLogSeverity, 47 | IN LPCWSTR pszLogMessageFormat, 48 | ... 49 | ); 50 | 51 | #endif 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/lib/tracing.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | HRESULT 7 | RegisterTraceArea( 8 | IN CONST WCHAR * szTraceProviderName, 9 | IN CONST WCHAR * szTraceProviderGuid, 10 | IN CONST WCHAR * szAreaName, 11 | IN CONST WCHAR * szAreaValue 12 | ); 13 | 14 | HRESULT 15 | GetElementFromCollection( 16 | IN IAppHostElementCollection * pCollection, 17 | IN CONST WCHAR * szPropertyName, 18 | IN CONST WCHAR * szExpectedPropertyValue, 19 | OUT IAppHostElement ** ppElement, 20 | OUT DWORD * pIndex = NULL 21 | ); 22 | 23 | struct NAME_VALUE_PAIR 24 | { 25 | LPCWSTR Name; 26 | CComVariant Value; 27 | }; 28 | 29 | HRESULT 30 | AddElementToCollection( 31 | IN IAppHostElementCollection * pCollection, 32 | IN CONST WCHAR * pElementName, 33 | IN NAME_VALUE_PAIR rgProperties[], 34 | IN DWORD cProperties, 35 | OUT IAppHostElement ** ppElement 36 | ); 37 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/iisca/wix3/ElevatedShortcut.wxi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | NOT SKIPMAKESHORTCUTELEVATED 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/include.wxi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/wcautil/memutil.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | //------------------------------------------------------------------------------------------------- 6 | // 7 | // Header for memory helper functions. 8 | // 9 | //------------------------------------------------------------------------------------------------- 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #define ReleaseMem(p) if (p) { MemFree(p); } 16 | #define ReleaseNullMem(p) if (p) { MemFree(p); p = NULL; } 17 | 18 | 19 | HRESULT DAPI MemInitialize(); 20 | void DAPI MemUninitialize(); 21 | 22 | LPVOID DAPI MemAlloc( 23 | __in SIZE_T cbSize, 24 | __in BOOL fZero 25 | ); 26 | LPVOID DAPI MemReAlloc( 27 | __in LPVOID pv, 28 | __in SIZE_T cbSize, 29 | __in BOOL fZero 30 | ); 31 | 32 | HRESULT DAPI MemFree( 33 | __in LPVOID pv 34 | ); 35 | SIZE_T DAPI MemSize( 36 | __in LPVOID pv 37 | ); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/IIS-Setup/wcautil/precomp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT license. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | const WCHAR MAGIC_MULTISZ_DELIM = 128; 12 | 13 | #include "wcautil.h" 14 | #include "memutil.h" 15 | #include "strutil.h" 16 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/AspNetCoreModule.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/AspNetCoreModule.ico -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/bannrbmp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/bannrbmp.bmp -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/dlgbmp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/AspNetCoreModule-Setup/bitmaps/dlgbmp.bmp -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/build/copy-outputs.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | $(Configuration)\$(PlatformShortname)\ 9 | 10 | 11 | 12 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/build/exports.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(MSBuildThisFileDirectory)..\ 7 | 8 | 9 | 10 | $(MSBuildThisFileDirectory)..\ 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/build/settings.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/build/settings/debug.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true 7 | true 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | true 16 | Disabled 17 | true 18 | EnableFastChecks 19 | MultiThreadedDebug 20 | 21 | 22 | false 23 | false 24 | true 25 | /JMC- 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Installers/Windows/AspNetCoreModule-Setup/build/submodule.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Installers/Windows/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)..\..\..\')) 5 | $(RepositoryRoot)artifacts/ 6 | $(RootOutputPath)bin/$(Configuration)/$(MSBuildProjectName)/ 7 | $(BaseOutputPath) 8 | $(RootOutputPath)obj/$(MSBuildProjectName)/ 9 | $(BaseIntermediateOutputPath)$(Configuration)/ 10 | $(IntermediateOutputPath)$(Platform)/ 11 | 12 | aspnetcore-runtime 13 | 14 | $(RuntimeInstallerBaseName)-internal 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Installers/Windows/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Installers/Windows/SharedFramework/DependencyProvider.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Installers/Windows/SharedFramework/Product.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | Microsoft ASP.NET Core Shared Framework 4 | Microsoft ASP.NET Core $(PackageBrandingVersion) Shared Framework ($(Platform)) 5 | AspNetCore.SharedFramework 6 | 7 | $(DefineConstants);ProductName=$(ProductName) 8 | $(DefineConstants);ProductNameShort=$(ProductNameShort) 9 | $(DefineConstants);ProductNameFolder=$(ProductNameFolder) 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Installers/Windows/SharedFramework/Strings.wxl: -------------------------------------------------------------------------------- 1 | 2 | 3 | ASP.NET Core Shared Framework 4 | ASP.NET Core Shared Framework 5 | -------------------------------------------------------------------------------- /src/Installers/Windows/SharedFrameworkBundle/DotNetLogo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/SharedFrameworkBundle/DotNetLogo.bmp -------------------------------------------------------------------------------- /src/Installers/Windows/WindowsHostingBundle/DotNetLogo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Installers/Windows/WindowsHostingBundle/DotNetLogo.bmp -------------------------------------------------------------------------------- /src/Installers/Windows/tasks/GenerateGuid.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Linq; 6 | using Microsoft.Build.Framework; 7 | using Microsoft.Build.Utilities; 8 | 9 | namespace RepoTasks 10 | { 11 | public class GenerateGuid : Task 12 | { 13 | [Output] 14 | public string Guid { get; private set; } 15 | 16 | [Required] 17 | public string NamespaceGuid { get; set; } 18 | 19 | [Required] 20 | public ITaskItem[] Values { get; set; } 21 | 22 | public override bool Execute() 23 | { 24 | try 25 | { 26 | var value = string.Join(",", Values.Select(o => o.ItemSpec).ToArray()).ToLowerInvariant(); 27 | 28 | Guid = Uuid.Create(new Guid(NamespaceGuid), value).ToString(); 29 | } 30 | catch (Exception e) 31 | { 32 | Log.LogErrorFromException(e); 33 | } 34 | 35 | return !Log.HasLoggedErrors; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Installers/Windows/tasks/GetMsiProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Build.Framework; 6 | using Microsoft.Build.Utilities; 7 | using Microsoft.Deployment.WindowsInstaller.Package; 8 | 9 | namespace RepoTasks 10 | { 11 | public class GetMsiProperty : Task 12 | { 13 | [Required] 14 | public string InstallPackage { get; set; } 15 | 16 | [Required] 17 | public string Property { get; set; } 18 | 19 | [Output] 20 | public string Value { get; set; } 21 | 22 | public override bool Execute() 23 | { 24 | try 25 | { 26 | using (var package = new InstallPackage(InstallPackage, 0)) 27 | { 28 | Value = package.Property[Property]; 29 | } 30 | } 31 | catch (Exception exception) 32 | { 33 | Log.LogErrorFromException(exception); 34 | } 35 | return !Log.HasLoggedErrors; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Installers/Windows/tasks/InstallerTasks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net461 5 | false 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.dll 17 | 18 | 19 | $(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/PackageArchive/Archive.CiServer.Patch.Compat/Archive.CiServer.Patch.Compat.zipproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | nuGetPackagesArchive-ci-server-compat-$(PackageVersion).patch.zip 8 | true 9 | false 10 | true 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.2.txt -------------------------------------------------------------------------------- /src/PackageArchive/Archive.CiServer.Patch/Archive.CiServer.Patch.zipproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | nuGetPackagesArchive-ci-server-$(PackageVersion).patch.zip 7 | true 8 | false 9 | false 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.2.txt -------------------------------------------------------------------------------- /src/PackageArchive/Archive.CiServer/Archive.CiServer.zipproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | nuGetPackagesArchive-ci-server-$(PackageVersion).zip 8 | false 9 | false 10 | false 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/PackageArchive/Archive.Lzma/Archive.Lzma.lzmaproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | nuGetPackagesArchive-$(PackageVersion).lzma 8 | false 9 | true 10 | true 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/PackageArchive/Archive.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | netcoreapp3.0 10 | 11 | 99.9 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/PackageArchive/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true 7 | 8 | true 9 | 10 | $([MSBuild]::NormalizePath('$(RepositoryRoot)obj\pkgs\')) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/PackageArchive/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/PackageArchive/README.md: -------------------------------------------------------------------------------- 1 | PackageArchive 2 | ============== 3 | 4 | See [docs/PackageArchives.md](/docs/PackageArchives.md) for details. 5 | 6 | See [ZipManifestGenerator](/src/PackageArchive/ZipManifestGenerator) for instructions on updating the build for new releases. 7 | -------------------------------------------------------------------------------- /src/PackageArchive/Scenario.ClassLibrary/Scenario.ClassLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/PackageArchive/Scenario.ConsoleApp/Scenario.ConsoleApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 99.9 6 | netcoreapp3.0 7 | 3.0.0 8 | 9 | $(MicrosoftNETCoreApp30PackageVersion) 10 | $([MSbuild]::ValueOrDefault('$(NETCoreImplicitVersion)','$(MaxImplicitVersion)')) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/PackageArchive/ZipManifestGenerator/README.md: -------------------------------------------------------------------------------- 1 | ZipManifestGenerator 2 | --------- 3 | 4 | This console app is used to generate the list of files in a zip archive. 5 | 6 | Usage: 7 | ``` 8 | Usage: 9 | 10 | A file path or URL to the ZIP file. 11 | The output file path for the ZIP manifest file. 12 | 13 | Example: dotnet run ./archive.zip files.txt 14 | ``` 15 | 16 | ## Example for servicing updates 17 | 18 | To generate a new manifest for the incremental CI server package caches, you would run 19 | 20 | ```ps1 21 | $ProdConBuild='20180919-01' 22 | $Version='2.1.5' 23 | 24 | $patchUrl = "https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/${ProdconBuild}/final/assets/aspnetcore/Runtime/${Version}/nuGetPackagesArchive-ci-server-${Version}.patch.zip" 25 | 26 | dotnet run $patchUrl "../Archive.CiServer.Patch/ArchiveBaseline.${Version}.txt" 27 | 28 | $compatPatchUrl = "https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/${ProdconBuild}/final/assets/aspnetcore/Runtime/${Version}/nuGetPackagesArchive-ci-server-compat-${Version}.patch.zip" 29 | 30 | dotnet run $compatPatchUrl "../Archive.CiServer.Patch.Compat/ArchiveBaseline.${Version}.txt" 31 | ``` 32 | -------------------------------------------------------------------------------- /src/PackageArchive/ZipManifestGenerator/ZipManifestGenerator.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | exe 5 | netcoreapp2.1 6 | false 7 | 7.1 8 | false 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Packages/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Packages/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NuGetPackage 6 | $(PackageId) 7 | $(PackageVersion) 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | netcoreapp3.0 7 | aspnetcore 8 | false 9 | Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. 10 | 11 | This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.props: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | <_AspNetCoreAppSharedFxIsEnabled>false 13 | 14 | 17 | <_AspNetCoreAllSharedFxIsEnabled>true 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.All/build/netcoreapp3.0/Microsoft.AspNetCore.All.targets: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | Microsoft.AspNetCore.All 11 | 12 | 13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.All/lib/netcoreapp3.0/_._: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Packages/Microsoft.AspNetCore.All/lib/netcoreapp3.0/_._ -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.Analyzers/Microsoft.AspNetCore.Analyzers.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | netstandard2.0 7 | aspnetcore 8 | Microsoft.AspNetCore.Analyzers 9 | 10 | $(ExperimentalVersionPrefix) 11 | $(ExperimentalVersionSuffix) 12 | $(ExperimentalPackageVersion) 13 | false 14 | 15 | false 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | netcoreapp3.0 7 | aspnetcore 8 | false 9 | Provides a default set of APIs for building an ASP.NET Core application. 10 | 11 | This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.props: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | <_AspNetCoreAppSharedFxIsEnabled Condition=" '$(_AspNetCoreAppSharedFxIsEnabled)' == '' ">true 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.App/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | Microsoft.AspNetCore.App 11 | 12 | 13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Packages/Microsoft.AspNetCore.App/lib/netcoreapp3.0/_._: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/src/Packages/Microsoft.AspNetCore.App/lib/netcoreapp3.0/_._ -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using Cli.FunctionalTests.Util; 5 | using NUnit.Framework; 6 | 7 | // Run all test cases in parallel 8 | [assembly: Parallelizable(ParallelScope.Children)] 9 | 10 | [SetUpFixture] 11 | public class AssemblySetUp 12 | { 13 | public static string TempDir { get; private set; } 14 | 15 | [OneTimeSetUp] 16 | public void SetUp() 17 | { 18 | TempDir = IOUtil.GetTempDir(); 19 | } 20 | 21 | [OneTimeTearDown] 22 | public void TearDown() 23 | { 24 | IOUtil.DeleteDir(TempDir); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Cli.FunctionalTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | false 6 | latest 7 | 8 | https://api.nuget.org/v3/index.json; 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Directory.Build.rsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspnet/Universe/9a907274e18f5b93df4b590403bbae39c2844313/test/Cli.FunctionalTests/Directory.Build.rsp -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/NuGet.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/README.md: -------------------------------------------------------------------------------- 1 | # Cli.FunctionalTests 2 | 3 | This folder contains tests for ASP.NET Core scenarios in the .NET Core CLI. 4 | 5 | This tests in this folder is meant to be kept in isolation from the rest of the repo, and are not invoked during the course of a regular build. 6 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Templates/ReactReduxTemplate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Cli.FunctionalTests.Templates 5 | { 6 | public class ReactReduxTemplate : ReactTemplate 7 | { 8 | public ReactReduxTemplate() { } 9 | 10 | public override string Name => "reactredux"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Templates/SpaBaseTemplate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | 8 | namespace Cli.FunctionalTests.Templates 9 | { 10 | public abstract class SpaBaseTemplate : RazorApplicationBaseTemplate 11 | { 12 | protected override string RazorPath => "Pages"; 13 | 14 | public override IEnumerable ExpectedObjFilesAfterBuild => 15 | base.ExpectedObjFilesAfterBuild 16 | .Concat(new[] 17 | { 18 | Path.Combine("Razor", RazorPath, "Error.g.cshtml.cs"), 19 | }.Select(p => Path.Combine(OutputPath, p))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Templates/TemplateType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | namespace Cli.FunctionalTests.Templates 5 | { 6 | public enum TemplateType 7 | { 8 | ClassLibrary, 9 | ConsoleApplication, 10 | WebApplication, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Templates/WebApiTemplate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | 5 | namespace Cli.FunctionalTests.Templates 6 | { 7 | public class WebApiTemplate : WebTemplate 8 | { 9 | public WebApiTemplate() { } 10 | 11 | public override string Name => "webapi"; 12 | 13 | public override string RelativeUrl => "/api/values"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/Util/ConcurrentStringBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Text; 5 | 6 | namespace Cli.FunctionalTests.Util 7 | { 8 | public class ConcurrentStringBuilder 9 | { 10 | private StringBuilder _stringBuilder = new StringBuilder(); 11 | private object _lock = new object(); 12 | 13 | public void AppendLine() 14 | { 15 | lock (_lock) 16 | { 17 | _stringBuilder.AppendLine(); 18 | } 19 | } 20 | 21 | public void AppendLine(string data) 22 | { 23 | lock (_lock) 24 | { 25 | _stringBuilder.AppendLine(data); 26 | } 27 | } 28 | 29 | public override string ToString() 30 | { 31 | lock (_lock) 32 | { 33 | return _stringBuilder.ToString(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/Cli.FunctionalTests/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dotnet test --logger "console;verbosity=detailed" "$@" 4 | -------------------------------------------------------------------------------- /test/SharedFx.UnitTests/AssertEx.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.IO; 5 | using Xunit.Sdk; 6 | 7 | namespace Microsoft.AspNetCore 8 | { 9 | public class AssertEx 10 | { 11 | public static void DirectoryExists(string path) 12 | { 13 | if (!Directory.Exists(path)) 14 | { 15 | throw new XunitException($"Expected directory to exist at {path} but it did not"); 16 | } 17 | } 18 | 19 | public static void FileExists(string path) 20 | { 21 | if (!File.Exists(path)) 22 | { 23 | throw new XunitException($"Expected file to exist at {path} but it did not"); 24 | } 25 | } 26 | 27 | public static void FileDoesNotExists(string path) 28 | { 29 | if (File.Exists(path)) 30 | { 31 | throw new XunitException($"File should not exist at {path}"); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/SharedFx.UnitTests/TestData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Linq; 5 | using System.Reflection; 6 | 7 | namespace Microsoft.AspNetCore 8 | { 9 | public class TestData 10 | { 11 | public static string GetPackageVersion() => GetTestDataValue("PackageVersion"); 12 | 13 | public static string GetMicrosoftNETCoreAppPackageVersion() => GetTestDataValue("MicrosoftNETCoreAppPackageVersion"); 14 | 15 | public static string GetDotNetRoot() => GetTestDataValue("DotNetRoot"); 16 | 17 | public static string GetRepositoryCommit() => GetTestDataValue("RepositoryCommit"); 18 | 19 | public static string GetSharedFxRuntimeIdentifier() => GetTestDataValue("SharedFxRuntimeIdentifier"); 20 | 21 | private static string GetTestDataValue(string key) 22 | => typeof(TestData).Assembly.GetCustomAttributes().Single(d => d.Key == key).Value; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/SharedFx.UnitTests/TestDataAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.AspNetCore 7 | { 8 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 9 | internal class TestDataAttribute : Attribute 10 | { 11 | public TestDataAttribute(string key, string value) 12 | { 13 | Key = key; 14 | Value = value; 15 | } 16 | 17 | public string Key { get; } 18 | public string Value { get; } 19 | } 20 | } 21 | --------------------------------------------------------------------------------