|
|
@@ -4,10 +4,7 @@
|
|
|
using System;
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
using System.Runtime.CompilerServices;
|
|
|
-using System.Runtime.InteropServices;
|
|
|
-using System.Runtime.Versioning;
|
|
|
using System.Xml.Linq;
|
|
|
-using Microsoft.AspNetCore.DataProtection;
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
namespace Microsoft.Extensions.Logging
|
|
|
@@ -15,414 +12,8 @@ namespace Microsoft.Extensions.Logging
|
|
|
/// <summary>
|
|
|
/// Helpful extension methods on <see cref="ILogger"/>.
|
|
|
/// </summary>
|
|
|
- internal static class LoggingExtensions
|
|
|
+ internal static partial class LoggingExtensions
|
|
|
{
|
|
|
- private static readonly Action<ILogger, Guid, DateTimeOffset, Exception?> _usingFallbackKeyWithExpirationAsDefaultKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _usingKeyAsDefaultKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, string?, Exception?> _openingCNGAlgorithmFromProviderWithHMAC;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, string?, Exception?> _openingCNGAlgorithmFromProviderWithChainingModeCBC;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, string, Exception?> _performingUnprotectOperationToKeyWithPurposes;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyWasRevokedCallerRequestedUnprotectOperationProceedRegardless;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyWasRevokedUnprotectOperationCannotProceed;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, string?, Exception?> _openingCNGAlgorithmFromProviderWithChainingModeGCM;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingManagedKeyedHashAlgorithm;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingManagedSymmetricAlgorithm;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, string, Exception> _keyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, DateTimeOffset, Exception?> _consideringKeyWithExpirationDateAsDefaultKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyIsNoLongerUnderConsiderationAsDefault;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, XName, Exception?> _unknownElementWithNameFoundInKeyringSkipping;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _markedKeyAsRevokedInTheKeyring;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _triedToProcessRevocationOfKeyButNoSuchKeyWasFound;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _foundKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, DateTimeOffset, Exception?> _foundRevocationOfAllKeysCreatedPriorTo;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _foundRevocationOfKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, XElement, Exception> _exceptionWhileProcessingRevocationElement;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, DateTimeOffset, string?, Exception?> _revokingAllKeysAsOfForReason;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _keyCacheExpirationTokenTriggeredByOperation;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, XElement, Exception> _anExceptionOccurredWhileProcessingTheKeyElement;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, XElement, Exception> _anExceptionOccurredWhileProcessingTheKeyElementDebug;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _encryptingToWindowsDPAPIForCurrentUserAccount;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _encryptingToWindowsDPAPINGUsingProtectionDescriptorRule;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception> _anErrorOccurredWhileEncryptingToX509CertificateWithThumbprint;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _encryptingToX509CertificateWithThumbprint;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception> _exceptionOccurredWhileTryingToResolveCertificateWithThumbprint;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, string, Exception?> _performingProtectOperationToKeyWithPurposes;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, DateTimeOffset, DateTimeOffset, DateTimeOffset, Exception?> _creatingKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, string, Exception?> _descriptorDeserializerTypeForKeyIs;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyEscrowSinkFoundWritingKeyToEscrow;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _noKeyEscrowSinkFoundNotWritingKeyToEscrow;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _noXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, DateTimeOffset, string?, Exception?> _revokingKeyForReason;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _readingDataFromFile;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, string, Exception?> _nameIsNotSafeFileName;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _writingDataToFile;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, RegistryKey, string, Exception?>? _readingDataFromRegistryKeyValue;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, string, Exception?> _nameIsNotSafeRegistryValueName;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string?, Exception?> _decryptingSecretElementUsingWindowsDPAPING;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _exceptionOccurredTryingToDecryptElement;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _encryptingUsingNullEncryptor;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _usingEphemeralDataProtectionProvider;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _existingCachedKeyRingIsExpiredRefreshing;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _errorOccurredWhileRefreshingKeyRing;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _errorOccurredWhileReadingKeyRing;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _keyRingDoesNotContainValidDefaultKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _usingInmemoryRepository;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _decryptingSecretElementUsingWindowsDPAPI;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _defaultKeyExpirationImminentAndRepository;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _repositoryContainsNoViableDefaultKey;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _errorOccurredWhileEncryptingToWindowsDPAPI;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _encryptingToWindowsDPAPIForLocalMachineAccount;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _errorOccurredWhileEncryptingToWindowsDPAPING;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _policyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Guid, Exception?> _keyRingWasLoadedOnStartup;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception> _keyRingFailedToLoadOnStartup;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, Exception?> _usingEphemeralKeyRepository;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingRegistryAsKeyRepositoryWithDPAPI;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingProfileAsKeyRepository;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingProfileAsKeyRepositoryWithDPAPI;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingAzureAsKeyRepository;
|
|
|
-
|
|
|
- private static readonly Action<ILogger, string, Exception?> _usingEphemeralFileSystemLocationInContainer;
|
|
|
-
|
|
|
- static LoggingExtensions()
|
|
|
- {
|
|
|
- _usingFallbackKeyWithExpirationAsDefaultKey = LoggerMessage.Define<Guid, DateTimeOffset>(
|
|
|
- eventId: new EventId(1, "UsingFallbackKeyWithExpirationAsDefaultKey"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Policy resolution states that a new key should be added to the key ring, but automatic generation of keys is disabled. Using fallback key {KeyId:B} with expiration {ExpirationDate:u} as default key.");
|
|
|
- _usingKeyAsDefaultKey = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(2, "UsingKeyAsDefaultKey"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Using key {KeyId:B} as the default key.");
|
|
|
- _openingCNGAlgorithmFromProviderWithHMAC = LoggerMessage.Define<string, string?>(
|
|
|
- eventId: new EventId(3, "OpeningCNGAlgorithmFromProviderWithHMAC"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Opening CNG algorithm '{HashAlgorithm}' from provider '{HashAlgorithmProvider}' with HMAC.");
|
|
|
- _openingCNGAlgorithmFromProviderWithChainingModeCBC = LoggerMessage.Define<string, string?>(
|
|
|
- eventId: new EventId(4, "OpeningCNGAlgorithmFromProviderWithChainingModeCBC"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode CBC.");
|
|
|
- _performingUnprotectOperationToKeyWithPurposes = LoggerMessage.Define<Guid, string>(
|
|
|
- eventId: new EventId(5, "PerformingUnprotectOperationToKeyWithPurposes"),
|
|
|
- logLevel: LogLevel.Trace,
|
|
|
- formatString: "Performing unprotect operation to key {KeyId:B} with purposes {Purposes}.");
|
|
|
- _keyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(6, "KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed"),
|
|
|
- logLevel: LogLevel.Trace,
|
|
|
- formatString: "Key {KeyId:B} was not found in the key ring. Unprotect operation cannot proceed.");
|
|
|
- _keyWasRevokedCallerRequestedUnprotectOperationProceedRegardless = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(7, "KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key {KeyId:B} was revoked. Caller requested unprotect operation proceed regardless.");
|
|
|
- _keyWasRevokedUnprotectOperationCannotProceed = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(8, "KeyWasRevokedUnprotectOperationCannotProceed"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key {KeyId:B} was revoked. Unprotect operation cannot proceed.");
|
|
|
- _openingCNGAlgorithmFromProviderWithChainingModeGCM = LoggerMessage.Define<string, string?>(
|
|
|
- eventId: new EventId(9, "OpeningCNGAlgorithmFromProviderWithChainingModeGCM"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode GCM.");
|
|
|
- _usingManagedKeyedHashAlgorithm = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(10, "UsingManagedKeyedHashAlgorithm"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Using managed keyed hash algorithm '{FullName}'.");
|
|
|
- _usingManagedSymmetricAlgorithm = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(11, "UsingManagedSymmetricAlgorithm"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Using managed symmetric algorithm '{FullName}'.");
|
|
|
- _keyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed = LoggerMessage.Define<Guid, string>(
|
|
|
- eventId: new EventId(12, "KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Key {KeyId:B} is ineligible to be the default key because its {MethodName} method failed.");
|
|
|
- _consideringKeyWithExpirationDateAsDefaultKey = LoggerMessage.Define<Guid, DateTimeOffset>(
|
|
|
- eventId: new EventId(13, "ConsideringKeyWithExpirationDateAsDefaultKey"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Considering key {KeyId:B} with expiration date {ExpirationDate:u} as default key.");
|
|
|
- _keyIsNoLongerUnderConsiderationAsDefault = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(14, "KeyIsNoLongerUnderConsiderationAsDefault"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key {KeyId:B} is no longer under consideration as default key because it is expired, revoked, or cannot be deciphered.");
|
|
|
- _unknownElementWithNameFoundInKeyringSkipping = LoggerMessage.Define<XName>(
|
|
|
- eventId: new EventId(15, "UnknownElementWithNameFoundInKeyringSkipping"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Unknown element with name '{Name}' found in keyring, skipping.");
|
|
|
- _markedKeyAsRevokedInTheKeyring = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(16, "MarkedKeyAsRevokedInTheKeyring"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Marked key {KeyId:B} as revoked in the keyring.");
|
|
|
- _triedToProcessRevocationOfKeyButNoSuchKeyWasFound = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(17, "TriedToProcessRevocationOfKeyButNoSuchKeyWasFound"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Tried to process revocation of key {KeyId:B}, but no such key was found in keyring. Skipping.");
|
|
|
- _foundKey = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(18, "FoundKey"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Found key {KeyId:B}.");
|
|
|
- _foundRevocationOfAllKeysCreatedPriorTo = LoggerMessage.Define<DateTimeOffset>(
|
|
|
- eventId: new EventId(19, "FoundRevocationOfAllKeysCreatedPriorTo"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Found revocation of all keys created prior to {RevocationDate:u}.");
|
|
|
- _foundRevocationOfKey = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(20, "FoundRevocationOfKey"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Found revocation of key {KeyId:B}.");
|
|
|
- _exceptionWhileProcessingRevocationElement = LoggerMessage.Define<XElement>(
|
|
|
- eventId: new EventId(21, "ExceptionWhileProcessingRevocationElement"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.");
|
|
|
- _revokingAllKeysAsOfForReason = LoggerMessage.Define<DateTimeOffset, string?>(
|
|
|
- eventId: new EventId(22, "RevokingAllKeysAsOfForReason"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Revoking all keys as of {RevocationDate:u} for reason '{Reason}'.");
|
|
|
- _keyCacheExpirationTokenTriggeredByOperation = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(23, "KeyCacheExpirationTokenTriggeredByOperation"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key cache expiration token triggered by '{OperationName}' operation.");
|
|
|
- _anExceptionOccurredWhileProcessingTheKeyElement = LoggerMessage.Define<XElement>(
|
|
|
- eventId: new EventId(24, "ExceptionOccurredWhileProcessingTheKeyElement"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An exception occurred while processing the key element '{Element}'.");
|
|
|
- _anExceptionOccurredWhileProcessingTheKeyElementDebug = LoggerMessage.Define<XElement>(
|
|
|
- eventId: new EventId(25, "ExceptionOccurredWhileProcessingTheKeyElementDebug"),
|
|
|
- logLevel: LogLevel.Trace,
|
|
|
- formatString: "An exception occurred while processing the key element '{Element}'.");
|
|
|
- _encryptingToWindowsDPAPIForCurrentUserAccount = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(26, "EncryptingToWindowsDPAPIForCurrentUserAccount"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Encrypting to Windows DPAPI for current user account ({Name}).");
|
|
|
- _encryptingToWindowsDPAPINGUsingProtectionDescriptorRule = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(27, "EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Encrypting to Windows DPAPI-NG using protection descriptor rule '{DescriptorRule}'.");
|
|
|
- _anErrorOccurredWhileEncryptingToX509CertificateWithThumbprint = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(28, "ErrorOccurredWhileEncryptingToX509CertificateWithThumbprint"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An error occurred while encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
|
|
|
- _encryptingToX509CertificateWithThumbprint = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(29, "EncryptingToX509CertificateWithThumbprint"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
|
|
|
- _exceptionOccurredWhileTryingToResolveCertificateWithThumbprint = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(30, "ExceptionOccurredWhileTryingToResolveCertificateWithThumbprint"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An exception occurred while trying to resolve certificate with thumbprint '{Thumbprint}'.");
|
|
|
- _performingProtectOperationToKeyWithPurposes = LoggerMessage.Define<Guid, string>(
|
|
|
- eventId: new EventId(31, "PerformingProtectOperationToKeyWithPurposes"),
|
|
|
- logLevel: LogLevel.Trace,
|
|
|
- formatString: "Performing protect operation to key {KeyId:B} with purposes {Purposes}.");
|
|
|
- _descriptorDeserializerTypeForKeyIs = LoggerMessage.Define<Guid, string>(
|
|
|
- eventId: new EventId(32, "DescriptorDeserializerTypeForKeyIs"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Descriptor deserializer type for key {KeyId:B} is '{AssemblyQualifiedName}'.");
|
|
|
- _keyEscrowSinkFoundWritingKeyToEscrow = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(33, "KeyEscrowSinkFoundWritingKeyToEscrow"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key escrow sink found. Writing key {KeyId:B} to escrow.");
|
|
|
- _noKeyEscrowSinkFoundNotWritingKeyToEscrow = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(34, "NoKeyEscrowSinkFoundNotWritingKeyToEscrow"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "No key escrow sink found. Not writing key {KeyId:B} to escrow.");
|
|
|
- _noXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(35, "NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "No XML encryptor configured. Key {KeyId:B} may be persisted to storage in unencrypted form.");
|
|
|
- _revokingKeyForReason = LoggerMessage.Define<Guid, DateTimeOffset, string?>(
|
|
|
- eventId: new EventId(36, "RevokingKeyForReason"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Revoking key {KeyId:B} at {RevocationDate:u} for reason '{Reason}'.");
|
|
|
- _readingDataFromFile = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(37, "ReadingDataFromFile"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Reading data from file '{FullPath}'.");
|
|
|
- _nameIsNotSafeFileName = LoggerMessage.Define<string, string>(
|
|
|
- eventId: new EventId(38, "NameIsNotSafeFileName"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "The name '{FriendlyName}' is not a safe file name, using '{NewFriendlyName}' instead.");
|
|
|
- _writingDataToFile = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(39, "WritingDataToFile"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Writing data to file '{FileName}'.");
|
|
|
-
|
|
|
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
- {
|
|
|
- _readingDataFromRegistryKeyValue = LoggerMessage.Define<RegistryKey, string>(
|
|
|
- eventId: new EventId(40, "ReadingDataFromRegistryKeyValue"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Reading data from registry key '{RegistryKeyName}', value '{Value}'.");
|
|
|
- }
|
|
|
-
|
|
|
- _nameIsNotSafeRegistryValueName = LoggerMessage.Define<string, string>(
|
|
|
- eventId: new EventId(41, "NameIsNotSafeRegistryValueName"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "The name '{FriendlyName}' is not a safe registry value name, using '{NewFriendlyName}' instead.");
|
|
|
- _decryptingSecretElementUsingWindowsDPAPING = LoggerMessage.Define<string?>(
|
|
|
- eventId: new EventId(42, "DecryptingSecretElementUsingWindowsDPAPING"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Decrypting secret element using Windows DPAPI-NG with protection descriptor rule '{DescriptorRule}'.");
|
|
|
- _exceptionOccurredTryingToDecryptElement = LoggerMessage.Define(
|
|
|
- eventId: new EventId(43, "ExceptionOccurredTryingToDecryptElement"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An exception occurred while trying to decrypt the element.");
|
|
|
- _encryptingUsingNullEncryptor = LoggerMessage.Define(
|
|
|
- eventId: new EventId(44, "EncryptingUsingNullEncryptor"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Encrypting using a null encryptor; secret information isn't being protected.");
|
|
|
- _usingEphemeralDataProtectionProvider = LoggerMessage.Define(
|
|
|
- eventId: new EventId(45, "UsingEphemeralDataProtectionProvider"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Using ephemeral data protection provider. Payloads will be undecipherable upon application shutdown.");
|
|
|
- _existingCachedKeyRingIsExpiredRefreshing = LoggerMessage.Define(
|
|
|
- eventId: new EventId(46, "ExistingCachedKeyRingIsExpiredRefreshing"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Existing cached key ring is expired. Refreshing.");
|
|
|
- _errorOccurredWhileRefreshingKeyRing = LoggerMessage.Define(
|
|
|
- eventId: new EventId(47, "ErrorOccurredWhileRefreshingKeyRing"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An error occurred while refreshing the key ring. Will try again in 2 minutes.");
|
|
|
- _errorOccurredWhileReadingKeyRing = LoggerMessage.Define(
|
|
|
- eventId: new EventId(48, "ErrorOccurredWhileReadingKeyRing"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An error occurred while reading the key ring.");
|
|
|
- _keyRingDoesNotContainValidDefaultKey = LoggerMessage.Define(
|
|
|
- eventId: new EventId(49, "KeyRingDoesNotContainValidDefaultKey"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "The key ring does not contain a valid default key, and the key manager is configured with auto-generation of keys disabled.");
|
|
|
- _usingInmemoryRepository = LoggerMessage.Define(
|
|
|
- eventId: new EventId(50, "UsingInMemoryRepository"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Using an in-memory repository. Keys will not be persisted to storage.");
|
|
|
- _decryptingSecretElementUsingWindowsDPAPI = LoggerMessage.Define(
|
|
|
- eventId: new EventId(51, "DecryptingSecretElementUsingWindowsDPAPI"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Decrypting secret element using Windows DPAPI.");
|
|
|
- _defaultKeyExpirationImminentAndRepository = LoggerMessage.Define(
|
|
|
- eventId: new EventId(52, "DefaultKeyExpirationImminentAndRepository"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Default key expiration imminent and repository contains no viable successor. Caller should generate a successor.");
|
|
|
- _repositoryContainsNoViableDefaultKey = LoggerMessage.Define(
|
|
|
- eventId: new EventId(53, "RepositoryContainsNoViableDefaultKey"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Repository contains no viable default key. Caller should generate a key with immediate activation.");
|
|
|
- _errorOccurredWhileEncryptingToWindowsDPAPI = LoggerMessage.Define(
|
|
|
- eventId: new EventId(54, "ErrorOccurredWhileEncryptingToWindowsDPAPI"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An error occurred while encrypting to Windows DPAPI.");
|
|
|
- _encryptingToWindowsDPAPIForLocalMachineAccount = LoggerMessage.Define(
|
|
|
- eventId: new EventId(55, "EncryptingToWindowsDPAPIForLocalMachineAccount"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Encrypting to Windows DPAPI for local machine account.");
|
|
|
- _errorOccurredWhileEncryptingToWindowsDPAPING = LoggerMessage.Define(
|
|
|
- eventId: new EventId(56, "ErrorOccurredWhileEncryptingToWindowsDPAPING"),
|
|
|
- logLevel: LogLevel.Error,
|
|
|
- formatString: "An error occurred while encrypting to Windows DPAPI-NG.");
|
|
|
- _policyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing = LoggerMessage.Define(
|
|
|
- eventId: new EventId(57, "PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Policy resolution states that a new key should be added to the key ring.");
|
|
|
- _creatingKey = LoggerMessage.Define<Guid, DateTimeOffset, DateTimeOffset, DateTimeOffset>(
|
|
|
- eventId: new EventId(58, "CreatingKey"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Creating key {KeyId:B} with creation date {CreationDate:u}, activation date {ActivationDate:u}, and expiration date {ExpirationDate:u}.");
|
|
|
- _usingEphemeralKeyRepository = LoggerMessage.Define(
|
|
|
- eventId: new EventId(59, "UsingEphemeralKeyRepository"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: "Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.");
|
|
|
- _usingEphemeralFileSystemLocationInContainer = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(60, "UsingEphemeralFileSystemLocationInContainer"),
|
|
|
- logLevel: LogLevel.Warning,
|
|
|
- formatString: Resources.FileSystem_EphemeralKeysLocationInContainer);
|
|
|
-
|
|
|
- _usingRegistryAsKeyRepositoryWithDPAPI = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(61, "UsingRegistryAsKeyRepositoryWithDPAPI"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "User profile not available. Using '{Name}' as key repository and Windows DPAPI to encrypt keys at rest.");
|
|
|
- _usingProfileAsKeyRepository = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(62, "UsingProfileAsKeyRepository"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "User profile is available. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
|
|
|
- _usingProfileAsKeyRepositoryWithDPAPI = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(63, "UsingProfileAsKeyRepositoryWithDPAPI"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.");
|
|
|
- _usingAzureAsKeyRepository = LoggerMessage.Define<string>(
|
|
|
- eventId: new EventId(64, "UsingAzureAsKeyRepository"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Azure Web Sites environment detected. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
|
|
|
- _keyRingWasLoadedOnStartup = LoggerMessage.Define<Guid>(
|
|
|
- eventId: new EventId(65, "KeyRingWasLoadedOnStartup"),
|
|
|
- logLevel: LogLevel.Debug,
|
|
|
- formatString: "Key ring with default key {KeyId:B} was loaded during application startup.");
|
|
|
- _keyRingFailedToLoadOnStartup = LoggerMessage.Define(
|
|
|
- eventId: new EventId(66, "KeyRingFailedToLoadOnStartup"),
|
|
|
- logLevel: LogLevel.Information,
|
|
|
- formatString: "Key ring failed to load during application startup.");
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Returns a value stating whether the 'debug' log level is enabled.
|
|
|
/// Returns false if the logger instance is null.
|
|
|
@@ -433,26 +24,6 @@ namespace Microsoft.Extensions.Logging
|
|
|
return IsLogLevelEnabledCore(logger, LogLevel.Debug);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Returns a value stating whether the 'error' log level is enabled.
|
|
|
- /// Returns false if the logger instance is null.
|
|
|
- /// </summary>
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
- public static bool IsErrorLevelEnabled([NotNullWhen(true)] this ILogger? logger)
|
|
|
- {
|
|
|
- return IsLogLevelEnabledCore(logger, LogLevel.Error);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Returns a value stating whether the 'information' log level is enabled.
|
|
|
- /// Returns false if the logger instance is null.
|
|
|
- /// </summary>
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
- public static bool IsInformationLevelEnabled([NotNullWhen(true)] this ILogger? logger)
|
|
|
- {
|
|
|
- return IsLogLevelEnabledCore(logger, LogLevel.Information);
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Returns a value stating whether the 'trace' log level is enabled.
|
|
|
/// Returns false if the logger instance is null.
|
|
|
@@ -463,354 +34,208 @@ namespace Microsoft.Extensions.Logging
|
|
|
return IsLogLevelEnabledCore(logger, LogLevel.Trace);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Returns a value stating whether the 'warning' log level is enabled.
|
|
|
- /// Returns false if the logger instance is null.
|
|
|
- /// </summary>
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
- public static bool IsWarningLevelEnabled([NotNullWhen(true)] this ILogger? logger)
|
|
|
- {
|
|
|
- return IsLogLevelEnabledCore(logger, LogLevel.Warning);
|
|
|
- }
|
|
|
-
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
private static bool IsLogLevelEnabledCore([NotNullWhen(true)] ILogger? logger, LogLevel level)
|
|
|
{
|
|
|
return (logger != null && logger.IsEnabled(level));
|
|
|
}
|
|
|
|
|
|
- public static void UsingFallbackKeyWithExpirationAsDefaultKey(this ILogger logger, Guid keyId, DateTimeOffset expirationDate)
|
|
|
- {
|
|
|
- _usingFallbackKeyWithExpirationAsDefaultKey(logger, keyId, expirationDate, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(1, LogLevel.Warning, "Policy resolution states that a new key should be added to the key ring, but automatic generation of keys is disabled. Using fallback key {KeyId:B} with expiration {ExpirationDate:u} as default key.", EventName = "UsingFallbackKeyWithExpirationAsDefaultKey")]
|
|
|
+ public static partial void UsingFallbackKeyWithExpirationAsDefaultKey(this ILogger logger, Guid keyId, DateTimeOffset expirationDate);
|
|
|
|
|
|
- public static void UsingKeyAsDefaultKey(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _usingKeyAsDefaultKey(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(2, LogLevel.Debug, "Using key {KeyId:B} as the default key.", EventName = "UsingKeyAsDefaultKey")]
|
|
|
+ public static partial void UsingKeyAsDefaultKey(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void OpeningCNGAlgorithmFromProviderWithHMAC(this ILogger logger, string hashAlgorithm, string? hashAlgorithmProvider)
|
|
|
- {
|
|
|
- _openingCNGAlgorithmFromProviderWithHMAC(logger, hashAlgorithm, hashAlgorithmProvider, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(3, LogLevel.Debug, "Opening CNG algorithm '{HashAlgorithm}' from provider '{HashAlgorithmProvider}' with HMAC.", EventName = "OpeningCNGAlgorithmFromProviderWithHMAC")]
|
|
|
+ public static partial void OpeningCNGAlgorithmFromProviderWithHMAC(this ILogger logger, string hashAlgorithm, string? hashAlgorithmProvider);
|
|
|
|
|
|
- public static void OpeningCNGAlgorithmFromProviderWithChainingModeCBC(this ILogger logger, string encryptionAlgorithm, string? encryptionAlgorithmProvider)
|
|
|
- {
|
|
|
- _openingCNGAlgorithmFromProviderWithChainingModeCBC(logger, encryptionAlgorithm, encryptionAlgorithmProvider, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(4, LogLevel.Debug, "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode CBC.", EventName = "OpeningCNGAlgorithmFromProviderWithChainingModeCBC")]
|
|
|
+ public static partial void OpeningCNGAlgorithmFromProviderWithChainingModeCBC(this ILogger logger, string encryptionAlgorithm, string? encryptionAlgorithmProvider);
|
|
|
|
|
|
- public static void PerformingUnprotectOperationToKeyWithPurposes(this ILogger logger, Guid keyIdFromPayload, string p0)
|
|
|
- {
|
|
|
- _performingUnprotectOperationToKeyWithPurposes(logger, keyIdFromPayload, p0, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(5, LogLevel.Trace, "Performing unprotect operation to key {KeyId:B} with purposes {Purposes}.", EventName = "PerformingUnprotectOperationToKeyWithPurposes")]
|
|
|
+ public static partial void PerformingUnprotectOperationToKeyWithPurposes(this ILogger logger, Guid keyId, string purposes);
|
|
|
|
|
|
- public static void KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed(this ILogger logger, Guid keyIdFromPayload)
|
|
|
- {
|
|
|
- _keyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed(logger, keyIdFromPayload, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(6, LogLevel.Trace, "Key {KeyId:B} was not found in the key ring. Unprotect operation cannot proceed.", EventName = "KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed")]
|
|
|
+ public static partial void KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless(this ILogger logger, Guid keyIdFromPayload)
|
|
|
- {
|
|
|
- _keyWasRevokedCallerRequestedUnprotectOperationProceedRegardless(logger, keyIdFromPayload, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(7, LogLevel.Debug, "Key {KeyId:B} was revoked. Caller requested unprotect operation proceed regardless.", EventName = "KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless")]
|
|
|
+ public static partial void KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void KeyWasRevokedUnprotectOperationCannotProceed(this ILogger logger, Guid keyIdFromPayload)
|
|
|
- {
|
|
|
- _keyWasRevokedUnprotectOperationCannotProceed(logger, keyIdFromPayload, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(8, LogLevel.Debug, "Key {KeyId:B} was revoked. Unprotect operation cannot proceed.", EventName = "KeyWasRevokedUnprotectOperationCannotProceed")]
|
|
|
+ public static partial void KeyWasRevokedUnprotectOperationCannotProceed(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void OpeningCNGAlgorithmFromProviderWithChainingModeGCM(this ILogger logger, string encryptionAlgorithm, string? encryptionAlgorithmProvider)
|
|
|
- {
|
|
|
- _openingCNGAlgorithmFromProviderWithChainingModeGCM(logger, encryptionAlgorithm, encryptionAlgorithmProvider, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(9, LogLevel.Debug, "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode GCM.", EventName = "OpeningCNGAlgorithmFromProviderWithChainingModeGCM")]
|
|
|
+ public static partial void OpeningCNGAlgorithmFromProviderWithChainingModeGCM(this ILogger logger, string encryptionAlgorithm, string? encryptionAlgorithmProvider);
|
|
|
|
|
|
- public static void UsingManagedKeyedHashAlgorithm(this ILogger logger, string fullName)
|
|
|
- {
|
|
|
- _usingManagedKeyedHashAlgorithm(logger, fullName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(10, LogLevel.Debug, "Using managed keyed hash algorithm '{FullName}'.", EventName = "UsingManagedKeyedHashAlgorithm")]
|
|
|
+ public static partial void UsingManagedKeyedHashAlgorithm(this ILogger logger, string fullName);
|
|
|
|
|
|
- public static void UsingManagedSymmetricAlgorithm(this ILogger logger, string fullName)
|
|
|
- {
|
|
|
- _usingManagedSymmetricAlgorithm(logger, fullName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(11, LogLevel.Debug, "Using managed symmetric algorithm '{FullName}'.", EventName = "UsingManagedSymmetricAlgorithm")]
|
|
|
+ public static partial void UsingManagedSymmetricAlgorithm(this ILogger logger, string fullName);
|
|
|
|
|
|
- public static void KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed(this ILogger logger, Guid keyId, string p0, Exception exception)
|
|
|
- {
|
|
|
- _keyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed(logger, keyId, p0, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(12, LogLevel.Warning, "Key {KeyId:B} is ineligible to be the default key because its {MethodName} method failed.", EventName = "KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed")]
|
|
|
+ public static partial void KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed(this ILogger logger, Guid keyId, string methodName, Exception exception);
|
|
|
|
|
|
- public static void ConsideringKeyWithExpirationDateAsDefaultKey(this ILogger logger, Guid keyId, DateTimeOffset expirationDate)
|
|
|
- {
|
|
|
- _consideringKeyWithExpirationDateAsDefaultKey(logger, keyId, expirationDate, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(13, LogLevel.Debug, "Considering key {KeyId:B} with expiration date {ExpirationDate:u} as default key.", EventName = "ConsideringKeyWithExpirationDateAsDefaultKey")]
|
|
|
+ public static partial void ConsideringKeyWithExpirationDateAsDefaultKey(this ILogger logger, Guid keyId, DateTimeOffset expirationDate);
|
|
|
|
|
|
- public static void KeyIsNoLongerUnderConsiderationAsDefault(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _keyIsNoLongerUnderConsiderationAsDefault(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(14, LogLevel.Debug, "Key {KeyId:B} is no longer under consideration as default key because it is expired, revoked, or cannot be deciphered.", EventName = "KeyIsNoLongerUnderConsiderationAsDefault")]
|
|
|
+ public static partial void KeyIsNoLongerUnderConsiderationAsDefault(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void UnknownElementWithNameFoundInKeyringSkipping(this ILogger logger, XName name)
|
|
|
- {
|
|
|
- _unknownElementWithNameFoundInKeyringSkipping(logger, name, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(15, LogLevel.Warning, "Unknown element with name '{Name}' found in keyring, skipping.", EventName = "UnknownElementWithNameFoundInKeyringSkipping")]
|
|
|
+ public static partial void UnknownElementWithNameFoundInKeyringSkipping(this ILogger logger, XName name);
|
|
|
|
|
|
- public static void MarkedKeyAsRevokedInTheKeyring(this ILogger logger, Guid revokedKeyId)
|
|
|
- {
|
|
|
- _markedKeyAsRevokedInTheKeyring(logger, revokedKeyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(16, LogLevel.Debug, "Marked key {KeyId:B} as revoked in the keyring.", EventName = "MarkedKeyAsRevokedInTheKeyring")]
|
|
|
+ public static partial void MarkedKeyAsRevokedInTheKeyring(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void TriedToProcessRevocationOfKeyButNoSuchKeyWasFound(this ILogger logger, Guid revokedKeyId)
|
|
|
- {
|
|
|
- _triedToProcessRevocationOfKeyButNoSuchKeyWasFound(logger, revokedKeyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(17, LogLevel.Warning, "Tried to process revocation of key {KeyId:B}, but no such key was found in keyring. Skipping.", EventName = "TriedToProcessRevocationOfKeyButNoSuchKeyWasFound")]
|
|
|
+ public static partial void TriedToProcessRevocationOfKeyButNoSuchKeyWasFound(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void FoundKey(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _foundKey(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(18, LogLevel.Debug, "Found key {KeyId:B}.", EventName = "FoundKey")]
|
|
|
+ public static partial void FoundKey(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void FoundRevocationOfAllKeysCreatedPriorTo(this ILogger logger, DateTimeOffset massRevocationDate)
|
|
|
- {
|
|
|
- _foundRevocationOfAllKeysCreatedPriorTo(logger, massRevocationDate, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(19, LogLevel.Debug, "Found revocation of all keys created prior to {RevocationDate:u}.", EventName = "FoundRevocationOfAllKeysCreatedPriorTo")]
|
|
|
+ public static partial void FoundRevocationOfAllKeysCreatedPriorTo(this ILogger logger, DateTimeOffset revocationDate);
|
|
|
|
|
|
- public static void FoundRevocationOfKey(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _foundRevocationOfKey(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(20, LogLevel.Debug, "Found revocation of key {KeyId:B}.", EventName = "FoundRevocationOfKey")]
|
|
|
+ public static partial void FoundRevocationOfKey(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void ExceptionWhileProcessingRevocationElement(this ILogger logger, XElement revocationElement, Exception exception)
|
|
|
- {
|
|
|
- _exceptionWhileProcessingRevocationElement(logger, revocationElement, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(21, LogLevel.Error, "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.", EventName = "ExceptionWhileProcessingRevocationElement")]
|
|
|
+ public static partial void ExceptionWhileProcessingRevocationElement(this ILogger logger, XElement revocationElement, Exception exception);
|
|
|
|
|
|
- public static void RevokingAllKeysAsOfForReason(this ILogger logger, DateTimeOffset revocationDate, string? reason)
|
|
|
- {
|
|
|
- _revokingAllKeysAsOfForReason(logger, revocationDate, reason, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(22, LogLevel.Information, "Revoking all keys as of {RevocationDate:u} for reason '{Reason}'.", EventName = "RevokingAllKeysAsOfForReason")]
|
|
|
+ public static partial void RevokingAllKeysAsOfForReason(this ILogger logger, DateTimeOffset revocationDate, string? reason);
|
|
|
|
|
|
- public static void KeyCacheExpirationTokenTriggeredByOperation(this ILogger logger, string opName)
|
|
|
- {
|
|
|
- _keyCacheExpirationTokenTriggeredByOperation(logger, opName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(23, LogLevel.Debug, "Key cache expiration token triggered by '{OperationName}' operation.", EventName = "KeyCacheExpirationTokenTriggeredByOperation")]
|
|
|
+ public static partial void KeyCacheExpirationTokenTriggeredByOperation(this ILogger logger, string operationName);
|
|
|
|
|
|
- public static void ExceptionWhileProcessingKeyElement(this ILogger logger, XElement keyElement, Exception exception)
|
|
|
- {
|
|
|
- _anExceptionOccurredWhileProcessingTheKeyElement(logger, keyElement, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(24, LogLevel.Error, "An exception occurred while processing the key element '{Element}'.", EventName = "ExceptionOccurredWhileProcessingTheKeyElement")]
|
|
|
+ public static partial void ExceptionWhileProcessingKeyElement(this ILogger logger, XElement element, Exception exception);
|
|
|
|
|
|
- public static void AnExceptionOccurredWhileProcessingElementDebug(this ILogger logger, XElement keyElement, Exception exception)
|
|
|
- {
|
|
|
- _anExceptionOccurredWhileProcessingTheKeyElementDebug(logger, keyElement, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(25, LogLevel.Trace, "An exception occurred while processing the key element '{Element}'.", EventName = "ExceptionOccurredWhileProcessingTheKeyElementDebug")]
|
|
|
+ public static partial void AnExceptionOccurredWhileProcessingElementDebug(this ILogger logger, XElement element, Exception exception);
|
|
|
|
|
|
- public static void EncryptingToWindowsDPAPIForCurrentUserAccount(this ILogger logger, string name)
|
|
|
- {
|
|
|
- _encryptingToWindowsDPAPIForCurrentUserAccount(logger, name, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(26, LogLevel.Debug, "Encrypting to Windows DPAPI for current user account ({Name}).", EventName = "EncryptingToWindowsDPAPIForCurrentUserAccount")]
|
|
|
+ public static partial void EncryptingToWindowsDPAPIForCurrentUserAccount(this ILogger logger, string name);
|
|
|
|
|
|
- public static void AnErrorOccurredWhileEncryptingToX509CertificateWithThumbprint(this ILogger logger, string thumbprint, Exception exception)
|
|
|
- {
|
|
|
- _anErrorOccurredWhileEncryptingToX509CertificateWithThumbprint(logger, thumbprint, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(28, LogLevel.Error, "An error occurred while encrypting to X.509 certificate with thumbprint '{Thumbprint}'.", EventName = "ErrorOccurredWhileEncryptingToX509CertificateWithThumbprint")]
|
|
|
+ public static partial void AnErrorOccurredWhileEncryptingToX509CertificateWithThumbprint(this ILogger logger, string thumbprint, Exception exception);
|
|
|
|
|
|
- public static void EncryptingToX509CertificateWithThumbprint(this ILogger logger, string thumbprint)
|
|
|
- {
|
|
|
- _encryptingToX509CertificateWithThumbprint(logger, thumbprint, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(29, LogLevel.Debug, "Encrypting to X.509 certificate with thumbprint '{Thumbprint}'.", EventName = "EncryptingToX509CertificateWithThumbprint")]
|
|
|
+ public static partial void EncryptingToX509CertificateWithThumbprint(this ILogger logger, string thumbprint);
|
|
|
|
|
|
- public static void ExceptionWhileTryingToResolveCertificateWithThumbprint(this ILogger logger, string thumbprint, Exception exception)
|
|
|
- {
|
|
|
- _exceptionOccurredWhileTryingToResolveCertificateWithThumbprint(logger, thumbprint, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(30, LogLevel.Error, "An exception occurred while trying to resolve certificate with thumbprint '{Thumbprint}'.", EventName = "ExceptionOccurredWhileTryingToResolveCertificateWithThumbprint")]
|
|
|
+ public static partial void ExceptionWhileTryingToResolveCertificateWithThumbprint(this ILogger logger, string thumbprint, Exception exception);
|
|
|
|
|
|
- public static void PerformingProtectOperationToKeyWithPurposes(this ILogger logger, Guid defaultKeyId, string p0)
|
|
|
- {
|
|
|
- _performingProtectOperationToKeyWithPurposes(logger, defaultKeyId, p0, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(31, LogLevel.Trace, "Performing protect operation to key {KeyId:B} with purposes {Purposes}.", EventName = "PerformingProtectOperationToKeyWithPurposes")]
|
|
|
+ public static partial void PerformingProtectOperationToKeyWithPurposes(this ILogger logger, Guid keyId, string purposes);
|
|
|
|
|
|
- public static void DescriptorDeserializerTypeForKeyIs(this ILogger logger, Guid keyId, string assemblyQualifiedName)
|
|
|
- {
|
|
|
- _descriptorDeserializerTypeForKeyIs(logger, keyId, assemblyQualifiedName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(32, LogLevel.Debug, "Descriptor deserializer type for key {KeyId:B} is '{AssemblyQualifiedName}'.", EventName = "DescriptorDeserializerTypeForKeyIs")]
|
|
|
+ public static partial void DescriptorDeserializerTypeForKeyIs(this ILogger logger, Guid keyId, string assemblyQualifiedName);
|
|
|
|
|
|
- public static void KeyEscrowSinkFoundWritingKeyToEscrow(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _keyEscrowSinkFoundWritingKeyToEscrow(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(33, LogLevel.Debug, "Key escrow sink found. Writing key {KeyId:B} to escrow.", EventName = "KeyEscrowSinkFoundWritingKeyToEscrow")]
|
|
|
+ public static partial void KeyEscrowSinkFoundWritingKeyToEscrow(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void NoKeyEscrowSinkFoundNotWritingKeyToEscrow(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _noKeyEscrowSinkFoundNotWritingKeyToEscrow(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(34, LogLevel.Debug, "No key escrow sink found. Not writing key {KeyId:B} to escrow.", EventName = "NoKeyEscrowSinkFoundNotWritingKeyToEscrow")]
|
|
|
+ public static partial void NoKeyEscrowSinkFoundNotWritingKeyToEscrow(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm(this ILogger logger, Guid keyId)
|
|
|
- {
|
|
|
- _noXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm(logger, keyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(35, LogLevel.Warning, "No XML encryptor configured. Key {KeyId:B} may be persisted to storage in unencrypted form.", EventName = "NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm")]
|
|
|
+ public static partial void NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void RevokingKeyForReason(this ILogger logger, Guid keyId, DateTimeOffset revocationDate, string? reason)
|
|
|
- {
|
|
|
- _revokingKeyForReason(logger, keyId, revocationDate, reason, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(36, LogLevel.Information, "Revoking key {KeyId:B} at {RevocationDate:u} for reason '{Reason}'.", EventName = "RevokingKeyForReason")]
|
|
|
+ public static partial void RevokingKeyForReason(this ILogger logger, Guid keyId, DateTimeOffset revocationDate, string? reason);
|
|
|
|
|
|
- public static void ReadingDataFromFile(this ILogger logger, string fullPath)
|
|
|
- {
|
|
|
- _readingDataFromFile(logger, fullPath, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(37, LogLevel.Debug, "Reading data from file '{FullPath}'.", EventName = "ReadingDataFromFile")]
|
|
|
+ public static partial void ReadingDataFromFile(this ILogger logger, string fullPath);
|
|
|
|
|
|
- public static void NameIsNotSafeFileName(this ILogger logger, string friendlyName, string newFriendlyName)
|
|
|
- {
|
|
|
- _nameIsNotSafeFileName(logger, friendlyName, newFriendlyName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(38, LogLevel.Debug, "The name '{FriendlyName}' is not a safe file name, using '{NewFriendlyName}' instead.", EventName = "NameIsNotSafeFileName")]
|
|
|
+ public static partial void NameIsNotSafeFileName(this ILogger logger, string friendlyName, string newFriendlyName);
|
|
|
|
|
|
- public static void WritingDataToFile(this ILogger logger, string finalFilename)
|
|
|
- {
|
|
|
- _writingDataToFile(logger, finalFilename, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(39, LogLevel.Information, "Writing data to file '{FileName}'.", EventName = "WritingDataToFile")]
|
|
|
+ public static partial void WritingDataToFile(this ILogger logger, string fileName);
|
|
|
|
|
|
- [SupportedOSPlatform("windows")]
|
|
|
- public static void ReadingDataFromRegistryKeyValue(this ILogger logger, RegistryKey regKey, string valueName)
|
|
|
- {
|
|
|
- if (_readingDataFromRegistryKeyValue != null)
|
|
|
- {
|
|
|
- _readingDataFromRegistryKeyValue(logger, regKey, valueName, null);
|
|
|
- }
|
|
|
- }
|
|
|
+ [LoggerMessage(40, LogLevel.Debug, "Reading data from registry key '{RegistryKeyName}', value '{Value}'.", EventName = "ReadingDataFromRegistryKeyValue")]
|
|
|
+ public static partial void ReadingDataFromRegistryKeyValue(this ILogger logger, RegistryKey registryKeyName, string value);
|
|
|
|
|
|
- public static void NameIsNotSafeRegistryValueName(this ILogger logger, string friendlyName, string newFriendlyName)
|
|
|
- {
|
|
|
- _nameIsNotSafeRegistryValueName(logger, friendlyName, newFriendlyName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(41, LogLevel.Debug, "The name '{FriendlyName}' is not a safe registry value name, using '{NewFriendlyName}' instead.", EventName = "NameIsNotSafeRegistryValueName")]
|
|
|
+ public static partial void NameIsNotSafeRegistryValueName(this ILogger logger, string friendlyName, string newFriendlyName);
|
|
|
|
|
|
- public static void DecryptingSecretElementUsingWindowsDPAPING(this ILogger logger, string? protectionDescriptorRule)
|
|
|
- {
|
|
|
- _decryptingSecretElementUsingWindowsDPAPING(logger, protectionDescriptorRule, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(42, LogLevel.Debug, "Decrypting secret element using Windows DPAPI-NG with protection descriptor rule '{DescriptorRule}'.", EventName = "DecryptingSecretElementUsingWindowsDPAPING")]
|
|
|
+ public static partial void DecryptingSecretElementUsingWindowsDPAPING(this ILogger logger, string? descriptorRule);
|
|
|
|
|
|
- public static void EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule(this ILogger logger, string protectionDescriptorRuleString)
|
|
|
- {
|
|
|
- _encryptingToWindowsDPAPINGUsingProtectionDescriptorRule(logger, protectionDescriptorRuleString, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(27, LogLevel.Debug, "Encrypting to Windows DPAPI-NG using protection descriptor rule '{DescriptorRule}'.", EventName = "EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule")]
|
|
|
+ public static partial void EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule(this ILogger logger, string descriptorRule);
|
|
|
|
|
|
- public static void ExceptionOccurredTryingToDecryptElement(this ILogger logger, Exception exception)
|
|
|
- {
|
|
|
- _exceptionOccurredTryingToDecryptElement(logger, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(43, LogLevel.Error, "An exception occurred while trying to decrypt the element.", EventName = "ExceptionOccurredTryingToDecryptElement")]
|
|
|
+ public static partial void ExceptionOccurredTryingToDecryptElement(this ILogger logger, Exception exception);
|
|
|
|
|
|
- public static void EncryptingUsingNullEncryptor(this ILogger logger)
|
|
|
- {
|
|
|
- _encryptingUsingNullEncryptor(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(44, LogLevel.Warning, "Encrypting using a null encryptor; secret information isn't being protected.", EventName = "EncryptingUsingNullEncryptor")]
|
|
|
+ public static partial void EncryptingUsingNullEncryptor(this ILogger logger);
|
|
|
|
|
|
- public static void UsingEphemeralDataProtectionProvider(this ILogger logger)
|
|
|
- {
|
|
|
- _usingEphemeralDataProtectionProvider(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(45, LogLevel.Information, "Using ephemeral data protection provider. Payloads will be undecipherable upon application shutdown.", EventName = "UsingEphemeralDataProtectionProvider")]
|
|
|
+ public static partial void UsingEphemeralDataProtectionProvider(this ILogger logger);
|
|
|
|
|
|
- public static void ExistingCachedKeyRingIsExpired(this ILogger logger)
|
|
|
- {
|
|
|
- _existingCachedKeyRingIsExpiredRefreshing(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(46, LogLevel.Debug, "Existing cached key ring is expired. Refreshing.", EventName = "ExistingCachedKeyRingIsExpiredRefreshing")]
|
|
|
+ public static partial void ExistingCachedKeyRingIsExpired(this ILogger logger);
|
|
|
|
|
|
- public static void ErrorOccurredWhileRefreshingKeyRing(this ILogger logger, Exception exception)
|
|
|
- {
|
|
|
- _errorOccurredWhileRefreshingKeyRing(logger, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(47, LogLevel.Error, "An error occurred while refreshing the key ring. Will try again in 2 minutes.", EventName = "ErrorOccurredWhileRefreshingKeyRing")]
|
|
|
+ public static partial void ErrorOccurredWhileRefreshingKeyRing(this ILogger logger, Exception exception);
|
|
|
|
|
|
- public static void ErrorOccurredWhileReadingKeyRing(this ILogger logger, Exception exception)
|
|
|
- {
|
|
|
- _errorOccurredWhileReadingKeyRing(logger, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(48, LogLevel.Error, "An error occurred while reading the key ring.", EventName = "ErrorOccurredWhileReadingKeyRing")]
|
|
|
+ public static partial void ErrorOccurredWhileReadingKeyRing(this ILogger logger, Exception exception);
|
|
|
|
|
|
- public static void KeyRingDoesNotContainValidDefaultKey(this ILogger logger)
|
|
|
- {
|
|
|
- _keyRingDoesNotContainValidDefaultKey(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(49, LogLevel.Error, "The key ring does not contain a valid default key, and the key manager is configured with auto-generation of keys disabled.", EventName = "KeyRingDoesNotContainValidDefaultKey")]
|
|
|
+ public static partial void KeyRingDoesNotContainValidDefaultKey(this ILogger logger);
|
|
|
|
|
|
- public static void UsingInmemoryRepository(this ILogger logger)
|
|
|
- {
|
|
|
- _usingInmemoryRepository(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(50, LogLevel.Warning, "Using an in-memory repository. Keys will not be persisted to storage.", EventName = "UsingInMemoryRepository")]
|
|
|
+ public static partial void UsingInmemoryRepository(this ILogger logger);
|
|
|
|
|
|
- public static void DecryptingSecretElementUsingWindowsDPAPI(this ILogger logger)
|
|
|
- {
|
|
|
- _decryptingSecretElementUsingWindowsDPAPI(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(51, LogLevel.Debug, "Decrypting secret element using Windows DPAPI.", EventName = "DecryptingSecretElementUsingWindowsDPAPI")]
|
|
|
+ public static partial void DecryptingSecretElementUsingWindowsDPAPI(this ILogger logger);
|
|
|
|
|
|
- public static void DefaultKeyExpirationImminentAndRepository(this ILogger logger)
|
|
|
- {
|
|
|
- _defaultKeyExpirationImminentAndRepository(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(52, LogLevel.Debug, "Default key expiration imminent and repository contains no viable successor. Caller should generate a successor.", EventName = "DefaultKeyExpirationImminentAndRepository")]
|
|
|
+ public static partial void DefaultKeyExpirationImminentAndRepository(this ILogger logger);
|
|
|
|
|
|
- public static void RepositoryContainsNoViableDefaultKey(this ILogger logger)
|
|
|
- {
|
|
|
- _repositoryContainsNoViableDefaultKey(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(53, LogLevel.Debug, "Repository contains no viable default key. Caller should generate a key with immediate activation.", EventName = "RepositoryContainsNoViableDefaultKey")]
|
|
|
+ public static partial void RepositoryContainsNoViableDefaultKey(this ILogger logger);
|
|
|
|
|
|
- public static void ErrorOccurredWhileEncryptingToWindowsDPAPI(this ILogger logger, Exception exception)
|
|
|
- {
|
|
|
- _errorOccurredWhileEncryptingToWindowsDPAPI(logger, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(54, LogLevel.Error, "An error occurred while encrypting to Windows DPAPI.", EventName = "ErrorOccurredWhileEncryptingToWindowsDPAPI")]
|
|
|
+ public static partial void ErrorOccurredWhileEncryptingToWindowsDPAPI(this ILogger logger, Exception exception);
|
|
|
|
|
|
- public static void EncryptingToWindowsDPAPIForLocalMachineAccount(this ILogger logger)
|
|
|
- {
|
|
|
- _encryptingToWindowsDPAPIForLocalMachineAccount(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(55, LogLevel.Debug, "Encrypting to Windows DPAPI for local machine account.", EventName = "EncryptingToWindowsDPAPIForLocalMachineAccount")]
|
|
|
+ public static partial void EncryptingToWindowsDPAPIForLocalMachineAccount(this ILogger logger);
|
|
|
|
|
|
- public static void ErrorOccurredWhileEncryptingToWindowsDPAPING(this ILogger logger, Exception exception)
|
|
|
- {
|
|
|
- _errorOccurredWhileEncryptingToWindowsDPAPING(logger, exception);
|
|
|
- }
|
|
|
+ [LoggerMessage(56, LogLevel.Error, "An error occurred while encrypting to Windows DPAPI-NG.", EventName = "ErrorOccurredWhileEncryptingToWindowsDPAPING")]
|
|
|
+ public static partial void ErrorOccurredWhileEncryptingToWindowsDPAPING(this ILogger logger, Exception exception);
|
|
|
|
|
|
- public static void PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing(this ILogger logger)
|
|
|
- {
|
|
|
- _policyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(57, LogLevel.Debug, "Policy resolution states that a new key should be added to the key ring.", EventName = "PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing")]
|
|
|
+ public static partial void PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing(this ILogger logger);
|
|
|
|
|
|
- public static void CreatingKey(this ILogger logger, Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate)
|
|
|
- {
|
|
|
- _creatingKey(logger, keyId, creationDate, activationDate, expirationDate, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(58, LogLevel.Information, "Creating key {KeyId:B} with creation date {CreationDate:u}, activation date {ActivationDate:u}, and expiration date {ExpirationDate:u}.", EventName = "CreatingKey")]
|
|
|
+ public static partial void CreatingKey(this ILogger logger, Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate);
|
|
|
|
|
|
- public static void UsingEphemeralKeyRepository(this ILogger logger)
|
|
|
- {
|
|
|
- _usingEphemeralKeyRepository(logger, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(59, LogLevel.Warning, "Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.", EventName = "UsingEphemeralKeyRepository")]
|
|
|
+ public static partial void UsingEphemeralKeyRepository(this ILogger logger);
|
|
|
|
|
|
- public static void UsingRegistryAsKeyRepositoryWithDPAPI(this ILogger logger, string name)
|
|
|
- {
|
|
|
- _usingRegistryAsKeyRepositoryWithDPAPI(logger, name, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(61, LogLevel.Information, "User profile not available. Using '{Name}' as key repository and Windows DPAPI to encrypt keys at rest.", EventName = "UsingRegistryAsKeyRepositoryWithDPAPI")]
|
|
|
+ public static partial void UsingRegistryAsKeyRepositoryWithDPAPI(this ILogger logger, string name);
|
|
|
|
|
|
- public static void UsingProfileAsKeyRepository(this ILogger logger, string fullName)
|
|
|
- {
|
|
|
- _usingProfileAsKeyRepository(logger, fullName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(62, LogLevel.Information, "User profile is available. Using '{FullName}' as key repository; keys will not be encrypted at rest.", EventName = "UsingProfileAsKeyRepository")]
|
|
|
+ public static partial void UsingProfileAsKeyRepository(this ILogger logger, string fullName);
|
|
|
|
|
|
- public static void UsingProfileAsKeyRepositoryWithDPAPI(this ILogger logger, string fullName)
|
|
|
- {
|
|
|
- _usingProfileAsKeyRepositoryWithDPAPI(logger, fullName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(63, LogLevel.Information, "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.", EventName = "UsingProfileAsKeyRepositoryWithDPAPI")]
|
|
|
+ public static partial void UsingProfileAsKeyRepositoryWithDPAPI(this ILogger logger, string fullName);
|
|
|
|
|
|
- public static void UsingAzureAsKeyRepository(this ILogger logger, string fullName)
|
|
|
- {
|
|
|
- _usingAzureAsKeyRepository(logger, fullName, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(64, LogLevel.Information, "Azure Web Sites environment detected. Using '{FullName}' as key repository; keys will not be encrypted at rest.", EventName = "UsingAzureAsKeyRepository")]
|
|
|
+ public static partial void UsingAzureAsKeyRepository(this ILogger logger, string fullName);
|
|
|
|
|
|
- public static void KeyRingWasLoadedOnStartup(this ILogger logger, Guid defaultKeyId)
|
|
|
- {
|
|
|
- _keyRingWasLoadedOnStartup(logger, defaultKeyId, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(65, LogLevel.Debug, "Key ring with default key {KeyId:B} was loaded during application startup.", EventName = "KeyRingWasLoadedOnStartup")]
|
|
|
+ public static partial void KeyRingWasLoadedOnStartup(this ILogger logger, Guid keyId);
|
|
|
|
|
|
- public static void KeyRingFailedToLoadOnStartup(this ILogger logger, Exception innerException)
|
|
|
- {
|
|
|
- _keyRingFailedToLoadOnStartup(logger, innerException);
|
|
|
- }
|
|
|
+ [LoggerMessage(66, LogLevel.Information, "Key ring failed to load during application startup.", EventName = "KeyRingFailedToLoadOnStartup")]
|
|
|
+ public static partial void KeyRingFailedToLoadOnStartup(this ILogger logger, Exception innerException);
|
|
|
|
|
|
- public static void UsingEphemeralFileSystemLocationInContainer(this ILogger logger, string path)
|
|
|
- {
|
|
|
- _usingEphemeralFileSystemLocationInContainer(logger, path, null);
|
|
|
- }
|
|
|
+ [LoggerMessage(60, LogLevel.Warning, "Storing keys in a directory '{path}' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.", EventName = "UsingEphemeralFileSystemLocationInContainer")]
|
|
|
+ public static partial void UsingEphemeralFileSystemLocationInContainer(this ILogger logger, string path);
|
|
|
}
|
|
|
}
|