Example #1
0
        protected override void ProcessRecord()
        {
            ManagedRSAEncryption managedRSA = new ManagedRSAEncryption();

            if (!managedRSA.ImportKeyToKSP(ProviderName, KeyName, FilePath, MakeExportable.IsPresent))
            {
                //Creation failed, likely already exists
                this.WriteError(
                    new ErrorRecord(
                        new InvalidOperationException("Key Import failed"),
                        "KeyImportFailure",
                        ErrorCategory.InvalidOperation,
                        null));
            }
        }