New-SelfSignedCertificate

New-SelfSignedCertificate

Creates a new self-signed certificate for testing purposes.

구문

Parameter Set: Default
New-SelfSignedCertificate [-CertStoreLocation <String> ] [-CloneCert <Certificate> ] [-DnsName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

자세한 설명

The New-SelfSignedCertificate cmdlet creates a self-signed certificate for testing purposes. Using the CloneCert parameter, a test certificate can be created based on an existing certificate with all settings copied from the original certificate except for the public key. A new key of the same algorithm and length will be created.

If an existing certificate is not being cloned, then an SSL server certificate with the following default settings is created:
-- Subject: Empty
-- Key: RSA 2048
-- EKUs: Client Authentication and Server Authentication
-- Key Usage: Digital Signature, Key Encipherment (a0)
-- Validity Period: One year

Delegation may be required when using this cmdlet with Windows PowerShell remoting and changing user configuration.

매개 변수

-CertStoreLocation<String>

Specifies the certificate store in which a new certificate will be stored. The current path is the default value.

별칭

없음

필수 여부

false

위치

named

기본값

.

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-CloneCert<Certificate>

Identifies the certificate to copy when creating a new certificate. The certificate being cloned can be identified by an X509 certificate or the file path in the certificate provider. When this parameter is used, all fields and extensions of the certificate will be inherited except the public key (a new key of the same algorithm and length will be created) and the NotAfter and NotBefore fields (the validity period for the NotBefore field is set to ten minutes in the past).

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

true (ByValue)

와일드카드 문자 허용 여부

false

-DnsName<String>

Specifies one or more DNS names to put into the Subject Alternative Name extension of the certificate when a certificate to be copied is not specified via the CloneCert parameter. The first DNS name is also saved as Subject Name and Issuer Name.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Confirm

cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-WhatIf

cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • Microsoft.CertificateServices.Commands.Certificate

    The Certificate object can either be provided as a Path object to a certificate or a X509Certificate2 object.

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • System.Security.Cryptography.X509Certificates.X509Certificate2

    A X509Certificate2 object for the certificate that has been created.

예제

EXAMPLE 1

This example creates a self-signed SSL server certificate in the computer MY store with the Subject Alternative Name set to www.fabrikam.com, www.contoso.com and Subject and Issuer name set to www.fabrikam.com.

PS C:\> New-SelfSignedCertificate -DnsName www.fabrikam.com, www.contoso.com -CertStoreLocation cert:\LocalMachine\My

EXAMPLE 2

This example creates a copy of the certificate specified by the CloneCert parameter and puts it in the computer MY store.

PS C:\> Set-Location -Path cert:\LocalMachine\My
PS C:\> $copyOf = (Get-ChildItem -Path E42DBC3B3F2771990A9B3E35D0C3C422779DACD7)
PS C:\> New-SelfSignedCertificate -CloneCert $copyOf

관련 항목

Get-ChildItem

Set-Location