X509Certificate 클래스

정의

X.509 v.3 인증서를 사용할 수 있도록 하는 메서드를 제공합니다.

public ref class X509Certificate : IDisposable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public ref class X509Certificate : IDisposable
public ref class X509Certificate
public ref class X509Certificate : System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public class X509Certificate : IDisposable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public class X509Certificate : IDisposable
[System.Serializable]
public class X509Certificate
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class X509Certificate : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class X509Certificate : IDisposable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type X509Certificate = class
    interface IDisposable
    interface IDeserializationCallback
    interface ISerializable
type X509Certificate = class
    interface IDisposable
type X509Certificate = class
    interface IDisposable
    interface ISerializable
    interface IDeserializationCallback
[<System.Serializable>]
type X509Certificate = class
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type X509Certificate = class
    interface IDeserializationCallback
    interface ISerializable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type X509Certificate = class
    interface IDisposable
    interface IDeserializationCallback
    interface ISerializable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type X509Certificate = class
    interface IDeserializationCallback
    interface ISerializable
    interface IDisposable
Public Class X509Certificate
Implements IDeserializationCallback, IDisposable, ISerializable
Public Class X509Certificate
Implements IDisposable
Public Class X509Certificate
Public Class X509Certificate
Implements IDeserializationCallback, ISerializable
상속
X509Certificate
파생
특성
구현

예제

다음 예제에서는 파일에서 X.509 인증서를 로드하고, 메서드를 ToString 호출하고, 결과를 콘솔에 표시합니다.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   
   // The path to the certificate.
   String^ Certificate = L"Certificate.cer";
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ cert = gcnew X509Certificate( Certificate );
   
   // Get the value.
   String^ resultsTrue = cert->ToString( true );
   
   // Display the value to the console.
   Console::WriteLine( resultsTrue );
   
   // Get the value.
   String^ resultsFalse = cert->ToString( false );
   
   // Display the value to the console.
   Console::WriteLine( resultsFalse );
}
using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate = "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = new X509Certificate(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.
        Console.WriteLine(resultsTrue);

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.
        Console.WriteLine(resultsFalse);
    }
}
Imports System.Security.Cryptography.X509Certificates

Module X509

    Sub Main()

        ' The path to the certificate.
        Dim Certificate As String = "Certificate.cer"

        ' Load the certificate into an X509Certificate object.
        Dim cert As New X509Certificate(Certificate)

        ' Get the value.
        Dim resultsTrue As String = cert.ToString(True)

        ' Display the value to the console.
        Console.WriteLine(resultsTrue)

        ' Get the value.
        Dim resultsFalse As String = cert.ToString(False)

        ' Display the value to the console.
        Console.WriteLine(resultsFalse)

    End Sub
End Module

설명

ASN.1 DER는 이 클래스에서 지원하는 유일한 인증서 형식입니다.

대부분의 시나리오에서는 클래스를 X509Certificate2 대신 사용해야 합니다.

중요

.NET Framework 4.6부터 이 형식은 인터페이스를 IDisposable 구현합니다. 형식을 사용 하 여 마쳤으면 직접 또는 간접적으로의 삭제 해야 있습니다. 직접 형식의 dispose 호출 해당 Dispose 의 메서드를 try/catch 블록입니다. 삭제 하지 직접, 언어 구문 같은 사용 using (C#에서) 또는 Using (Visual Basic에서는). 자세한 내용은 "를 사용 하는 개체는 구현 IDisposable" 섹션을 참조 하세요.를 IDisposable 인터페이스 항목입니다.

.NET Framework 4.5.2 이전 버전을 대상으로 하는 앱의 X509Certificate 경우 클래스는 인터페이스를 IDisposable 구현하지 않으므로 메서드가 Dispose 없습니다.

생성자

X509Certificate()
사용되지 않습니다.

X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(Byte[])

X.509v3 인증서를 나타내는 바이트 시퀀스에서 정의된 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(Byte[], SecureString)

바이트 배열 및 암호를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(Byte[], SecureString, X509KeyStorageFlags)

바이트 배열, 암호 및 키 스토리지 플래그를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(Byte[], String)

바이트 배열 및 암호를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(Byte[], String, X509KeyStorageFlags)

바이트 배열, 암호 및 키 스토리지 플래그를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(IntPtr)

비관리 PCCERT_CONTEXT 구조체에 대한 핸들을 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(SerializationInfo, StreamingContext)

X509Certificate 개체 및 SerializationInfo 구조체를 사용하여 StreamingContext 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(String)

PKCS7 서명 파일의 이름을 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(String, SecureString)

인증서 파일 이름 및 암호를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(String, SecureString, X509KeyStorageFlags)

인증서 파일 이름, 암호 및 키 스토리지 플래그를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(String, String)

PKCS7 서명 파일의 이름과 인증서에 액세스하기 위한 암호를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(String, String, X509KeyStorageFlags)

PKCS7 서명 파일의 이름, 인증서에 액세스하기 위한 암호 및 키 스토리지 플래그를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

X509Certificate(X509Certificate)

다른 X509Certificate 클래스를 사용하여 X509Certificate 클래스의 새 인스턴스를 초기화합니다.

속성

Handle

비관리 PCCERT_CONTEXT 구조체로 설명되는 Microsoft 암호화 API 인증서 컨텍스트에 대한 핸들을 가져옵니다.

Issuer

X.509v3 인증서를 발급한 인증 기관의 이름을 가져옵니다.

Subject

인증서에서 구별된 주체 이름을 가져옵니다.

메서드

CreateFromCertFile(String)

지정된 PKCS7 서명 파일에서 X.509v3 인증서를 만듭니다.

CreateFromSignedFile(String)

지정된 서명 파일에서 X.509v3 인증서를 만듭니다.

Dispose()

현재 X509Certificate 개체에서 사용하는 모든 리소스를 해제합니다.

Dispose(Boolean)

X509Certificate에서 사용하는 관리되지 않는 모든 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

Equals(Object)

X509Certificate 개체가 같은지 비교합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Equals(X509Certificate)

X509Certificate 개체가 같은지 비교합니다.

Export(X509ContentType)

현재 X509Certificate 개체를 X509ContentType 값 중 하나로 설명되는 형식으로 바이트 배열로 내보냅니다.

Export(X509ContentType, SecureString)

지정된 형식 및 암호를 사용하여 현재 X509Certificate 개체를 바이트 배열로 내보냅니다.

Export(X509ContentType, String)

현재 X509Certificate 개체를 지정된 암호를 사용하여 X509ContentType 값 중 하나로 설명되는 형식으로 바이트 배열로 내보냅니다.

FormatDate(DateTime)

지정된 날짜 및 시간을 문자열로 변환합니다.

GetCertHash()

X.509v3 인증서에 대한 해시 값을 바이트 배열로 반환합니다.

GetCertHash(HashAlgorithmName)

지정된 암호화 해시 알고리즘을 사용하여 계산된 X.509v3 인증서에 대한 해시 값을 반환합니다.

GetCertHashString()

X.509v3 인증서의 SHA1 해시 값을 16진수 문자열로 반환합니다.

GetCertHashString(HashAlgorithmName)

지정된 암호화 해시 알고리즘을 사용하여 계산된 X.509v3 인증서에 대한 해시 값을 포함하는 16진수 문자열을 반환합니다.

GetEffectiveDateString()

이 X.509v3 인증서의 개시 날짜를 반환합니다.

GetExpirationDateString()

이 X.509v3 인증서의 만료 날짜를 반환합니다.

GetFormat()

이 X.509v3 인증서의 형식 이름을 반환합니다.

GetHashCode()

X.509v3 인증서에 대한 해시 코드를 정수로 반환합니다.

GetIssuerName()
사용되지 않습니다.
사용되지 않습니다.
사용되지 않습니다.
사용되지 않습니다.

X.509v3 인증서를 발급한 인증 기관의 이름을 반환합니다.

GetKeyAlgorithm()

이 X.509v3 인증서의 키 알고리즘 정보를 문자열로 반환합니다.

GetKeyAlgorithmParameters()

X.509v3 인증서에 대한 키 알고리즘 매개 변수(바이트 배열)를 반환합니다.

GetKeyAlgorithmParametersString()

X.509v3 인증서의 키 알고리즘 매개 변수를 16진수 문자열로 반환합니다.

GetName()
사용되지 않습니다.
사용되지 않습니다.
사용되지 않습니다.
사용되지 않습니다.

인증서가 발행된 대상 보안 주체의 이름을 반환합니다.

GetPublicKey()

X.509v3 인증서에 대한 공개 키(바이트 배열)를 반환합니다.

GetPublicKeyString()

X.509v3 인증서에 대한 공개 키(16진 문자열)를 반환합니다.

GetRawCertData()

전체 X.509v3 인증서에 대한 원시 데이터(바이트 배열)를 반환합니다.

GetRawCertDataString()

전체 X.509v3 인증서에 대한 원시 데이터(16진 문자열)를 반환합니다.

GetSerialNumber()

X.509v3 인증서의 일련 번호를 Little Endian 순서의 바이트 배열로 반환합니다.

GetSerialNumberString()

X.509v3 인증서의 일련 번호를 Little Endian 16진 문자열로 반환합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
Import(Byte[])
사용되지 않습니다.

바이트 배열의 데이터로 X509Certificate 개체를 채웁니다.

Import(Byte[], SecureString, X509KeyStorageFlags)
사용되지 않습니다.

바이트 배열 데이터, 암호 및 키 스토리지 플래그를 사용하여 X509Certificate 개체를 채웁니다.

Import(Byte[], String, X509KeyStorageFlags)
사용되지 않습니다.

바이트 배열의 데이터, 암호 및 프라이빗 키 가져오기 방법을 결정하기 위한 플래그를 사용하여 X509Certificate 개체를 채웁니다.

Import(String)
사용되지 않습니다.

인증서 파일의 정보로 X509Certificate 개체를 채웁니다.

Import(String, SecureString, X509KeyStorageFlags)
사용되지 않습니다.

인증서 파일의 정보, 암호 및 키 스토리지 플래그로 X509Certificate 개체를 채웁니다.

Import(String, String, X509KeyStorageFlags)
사용되지 않습니다.

인증서 파일의 정보, 암호 및 X509Certificate 값으로 X509KeyStorageFlags 개체를 채웁니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Reset()

X509Certificate2 개체의 상태를 다시 설정합니다.

ToString()

현재 X509Certificate 개체의 문자열 표현을 반환합니다.

ToString(Boolean)

지정되면 추가 정보와 함께 현재 X509Certificate 개체의 문자열 표현을 반환합니다.

TryGetCertHash(HashAlgorithmName, Span<Byte>, Int32)

지정된 해시 알고리즘을 통해 인코딩된 인증서 표현을 해시하여 인증서의 “지문”을 생성하려고 합니다.

명시적 인터페이스 구현

IDeserializationCallback.OnDeserialization(Object)

ISerializable 인터페이스를 구현하고 역직렬화가 완료되면 역직렬화 이벤트에 의해 콜백됩니다.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

현재 X509Certificate 개체의 인스턴스를 다시 만드는 데 필요한 모든 데이터가 포함된 serialization 정보를 가져옵니다.

적용 대상