コード例 #1
0
        protected override void ProcessRecord()
        {
            KeyCredential keyCredential;

            switch (this.ParameterSetName)
            {
            case ParamSetFromDNBinary:
                keyCredential = KeyCredential.Parse(this.DNWithBinaryData);
                break;

            case ParamSetFromBinary:
                keyCredential = new KeyCredential(this.BinaryData, this.HolderDN);
                break;

            case ParamSetFromCertificate:
            default:
                if (this.CreationTime.HasValue)
                {
                    keyCredential = new KeyCredential(this.Certificate, this.DeviceId, this.HolderDN, this.CreationTime.Value);
                }
                else
                {
                    keyCredential = new KeyCredential(this.Certificate, this.DeviceId, this.HolderDN);
                }
                break;
            }
            this.WriteObject(keyCredential);
        }
コード例 #2
0
        protected override void ProcessRecord()
        {
            KeyCredential keyCredential;

            switch (this.ParameterSetName)
            {
            case ParamSetFromDNBinary:
                foreach (string singleValue in this.DNWithBinaryData)
                {
                    keyCredential = KeyCredential.Parse(singleValue);
                    this.WriteObject(keyCredential);
                }
                break;

            case ParamSetFromBinary:
                keyCredential = new KeyCredential(this.BinaryData, this.HolderDN);
                this.WriteObject(keyCredential);
                break;

            case ParamSetFromUserCertificate:
            case ParamSetFromComputerCertificate:
                keyCredential = new KeyCredential(this.Certificate, this.DeviceId, this.HolderDN, this.CreationTime, this.IsComputerKey.IsPresent);
                this.WriteObject(keyCredential);
                break;
            }
        }