• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Class NeonVault

    Manages the encryption and decryption of files using passwords. This works a lot like Ansible Vault.

    Inheritance
    object
    NeonVault
    Namespace: Neon.Cryptography
    Assembly: Neon.Cryptography.dll
    Syntax
    public class NeonVault
    Remarks

    This class works by using AesCipher with a 256-bit key to encrypt and decrypt files using a Neon standard ASCII text file format. This encryption is performed using the value of a named password as the encryption key. The class depends on a password provider function like string LookupPassword(string) that will return the value for a named password.

    The idea here is that applications will define one or more named passwords like: mypassword1=GU6qc2vsJgmCWmdL and mypassword2=GBRDUqsX3GSKJ2af and then implement a password provider that returns the value of a password based on its name. You'll pass this provider to the NeonVault constructor.

    note

    Password names are case insensitive and will always be converted to lowercase using the invariant culture. Password names may include alphanumeric characters plus dashs, dots, or underscores.

    Password providers should throw an exception whenever the named password cannot be located. Most providers will throw a KeyNotFoundException when this happens.

    Encrypted files are encoded as ASCII and are formatted like:

    $NEON_VAULT;4C823A36774CA4AC760F31DD8ABE7BD3;1.0;AES256;PASSWORD-NAME
    4c5330744c5331435255644a5469424452564a5553555a4a51304655525330744c533074436b314a
    53554e3552454e4451574a445a30463353554a425a306c4351555242546b4a6e6133466f61326c48
    4f586377516b465263305a425245465754564a4e64305652575552575556464552586477636d5258
    536d774b5932303162475248566e704e516a5259524652464e5531455358644e616b557954587072
    4d4535736231684556456b3154555246656b314552544a4e656d7377546d787664305a555256524e
    516b564851544656525170426545314c59544e5761567059536e566157464a735933704451304654
    5358644555566c4b53323961535768325930354255555643516c46425247646e5256424252454e44
    515646765132646e52554a42536d6c50436c6b345a45395163324a454f466379526c6b30566a5274
    595570584d323032634452714e5467314e7a4131627a4e47527a6859564730724e33686957465130
    546b68775645686d646e686161584e685a6e6f304f54414b4c325a6a53454d32546b4d3464697445
    4e7a5a355931685156564a3164576f724f56646e51335133555670735a574d7954474a364b7a5a6f
    55466f7a4c32347962544e7a51573952536c527253574e7565485172625170575458527157554d35
    57573970633145305a453877634646444c3141784d6d4d7951586c46515663334d314a4555314256
    526e597a555770365a47777255577052564556784b3068305257704a52544659626b4a70436e4a42
    563078334d323872656d5a4f4e30684559555534596d7061636a4a765a7a687459574a454e566444
    4c30395656

    The first line of the file holds metadata that is used to identify encrypted files and also to identify the encryption method and name of the password to be used for decryption. The remaining lines encode the encrypted AesCipher output encoded as 80 character lines of HEX digits.

    This class considers files starting $NEON_VAULT;4C823A36774CA4AC760F31DD8ABE7BD3 to be encrypted. This essentially acts as a very unique magic number. This is followed by the NeonVault format version (currently 1.0), the encryption cypher (currently AES256), and the name of the password that was used for encryption.

    The decrypt methods are smart enough to determine whether a file is not encrypted and simply write the unencrypted data to the target. This means that you can safely call these methods on unencrypted data.

    This class provides several methods to encrypt and decrypt data given a password.

    note

    Source Stream instances passed to encryption and decryption methods must support reading and seeking and target Stream instances must support writing as well as reading and seeking to support HMAC signatures.

    Constructors

    NeonVault(Func<string, string>, string)

    Constructor.

    Declaration
    public NeonVault(Func<string, string> passwordProvider, string lineEnding = null)
    Parameters
    Type Name Description
    Func<string, string> passwordProvider

    Specifies the function that returns the password value for a named password.

    string lineEnding

    Optionally specifies line ending to be used when writing the output file. This defaults to the current platform's line ending: "\r\n" for Windows and "\n" for Linux, OS/X, etc.

    Fields

    MagicString

    The string at the beginning of all files encrypted by NeonVault. This is used to identify these files.

    Declaration
    public const string MagicString = "$NEON_VAULT;4C823A36774CA4AC760F31DD8ABE7BD3;"
    Field Value
    Type Description
    string

    Properties

    MagicBytes

    Returns MagicString encoded as a byte array for ease of use.

    Declaration
    public static byte[] MagicBytes { get; }
    Property Value
    Type Description
    byte[]

    Methods

    Decrypt(Stream)

    Decrypts a stream to a byte array.

    Declaration
    public byte[] Decrypt(Stream source)
    Parameters
    Type Name Description
    Stream source

    The source.

    Returns
    Type Description
    byte[]

    The decrypted byte array.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other decryption problems.

    Decrypt(Stream, Stream)

    Decrypts a stream to another stream.

    Declaration
    public void Decrypt(Stream source, Stream target)
    Parameters
    Type Name Description
    Stream source

    The source stream.

    Stream target

    The target stream.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other decryption problems.

    Decrypt(string)

    Decrypts file to a byte array.

    Declaration
    public byte[] Decrypt(string sourcePath)
    Parameters
    Type Name Description
    string sourcePath

    The source path.

    Returns
    Type Description
    byte[]

    The decrypted bytes.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other decryption problems.

    Decrypt(string, Stream)

    Decrypts a file to a stream.

    Declaration
    public void Decrypt(string sourcePath, Stream target)
    Parameters
    Type Name Description
    string sourcePath

    The source path.

    Stream target

    The target stream.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other decryption problems.

    Decrypt(string, string)

    Decrypts a file to another file.

    Declaration
    public void Decrypt(string sourcePath, string targetPath)
    Parameters
    Type Name Description
    string sourcePath

    The source path.

    string targetPath

    The target path.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other decryption problems.

    Encrypt(Stream, Stream, string)

    Encrypts a stream to another stream.

    Declaration
    public void Encrypt(Stream source, Stream target, string passwordName)
    Parameters
    Type Name Description
    Stream source

    The source stream.

    Stream target

    The target stream.

    string passwordName

    Identifies the password.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other encryption problems.

    Encrypt(Stream, string)

    Encrypts a stream to a byte array.

    Declaration
    public byte[] Encrypt(Stream source, string passwordName)
    Parameters
    Type Name Description
    Stream source

    The source stream.

    string passwordName

    Identifies the password.

    Returns
    Type Description
    byte[]

    The encrypted bytes.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other encryption problems.

    Encrypt(Stream, string, string)

    Encrypts a stream to a file.

    Declaration
    public void Encrypt(Stream source, string targetPath, string passwordName)
    Parameters
    Type Name Description
    Stream source

    The source stream.

    string targetPath

    The target path.

    string passwordName

    Identifies the password.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other encryption problems.

    Encrypt(string, string)

    Encrypts a file to a byte array.

    Declaration
    public byte[] Encrypt(string sourcePath, string passwordName)
    Parameters
    Type Name Description
    string sourcePath

    The source path.

    string passwordName

    Identifies the password.

    Returns
    Type Description
    byte[]

    The encrypted bytes.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other encryption problems.

    Encrypt(string, string, string)

    Encrypts a file to another file.

    Declaration
    public void Encrypt(string sourcePath, string targetPath, string passwordName)
    Parameters
    Type Name Description
    string sourcePath

    The source path.

    string targetPath

    The target path.

    string passwordName

    Identifies the password.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the password was not found or for other encryption problems.

    IsEncrypted(Stream)

    Determines if a stream is encrypted via NeonVault.

    Declaration
    public static bool IsEncrypted(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The stream.

    Returns
    Type Description
    bool

    true if the stream is encrypted.

    Remarks
    note

    The stream position must be at the beginning of the stream for this to work.

    IsEncrypted(Stream, out string)

    Determines if a stream is encrypted via NeonVault and returns the name of the password used.

    Declaration
    public static bool IsEncrypted(Stream stream, out string passwordName)
    Parameters
    Type Name Description
    Stream stream

    The stream.

    string passwordName

    For encrypted files, this returns as the name of the password used.

    Returns
    Type Description
    bool

    true if the stream is encrypted.

    Remarks
    note

    The stream position must be at the beginning of the stream for this to work.

    IsEncrypted(string)

    Determines if a file is encrypted via NeonVault.

    Declaration
    public static bool IsEncrypted(string path)
    Parameters
    Type Name Description
    string path

    The file path.

    Returns
    Type Description
    bool

    true if the file is encrypted.

    IsEncrypted(string, out string)

    Determines if a file is encrypted via NeonVault and returns the name of the password used.

    Declaration
    public static bool IsEncrypted(string path, out string passwordName)
    Parameters
    Type Name Description
    string path

    The file path.

    string passwordName

    For encrypted files, this returns as the name of the password used.

    Returns
    Type Description
    bool

    true if the file is encrypted.

    ValidatePasswordName(string)

    Ensures that a password name is valid.

    Declaration
    public static string ValidatePasswordName(string passwordName)
    Parameters
    Type Name Description
    string passwordName

    The password name.

    Returns
    Type Description
    string

    The password name converted to lowercase.

    Exceptions
    Type Condition
    CryptographicException

    Thrown if the name is invalid.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC