C# 클래스 Brunet.Security.CertificateHandler

.NET provides a very complicated (and complete) x509 Certificate handler. We do not require all those features and we also embed data that we use for quick retrieval that wouldn't be easy to reproduce using that framework. This model can be used on non-x509 certificate models and perhaps even abstract to support handshakes on pre-shared keys. In our system, certificate's serial numbers are equivalent to the data common to a certificate request and signed certificate, so that the model can support self-signed CAs. Thus a cert.SerialNumber == hash(cert.ca.unsigned data). This class is thread-safe.
파일 보기 프로젝트 열기: pstjuste/brunet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
CertDir String

보호된 프로퍼티들

프로퍼티 타입 설명
_cas X509Certificate>.Dictionary
_certificate_verifiers List
_lc X509Certificate>.Dictionary
_lc_issuers List
_local_id string
_supported_cas List
_sync object

공개 메소드들

메소드 설명
AddCACertificate ( Mono.Security.X509.X509Certificate cert ) : bool

Adds CA certificate to this CH.

AddCertificate ( string filename ) : bool
AddCertificateVerification ( ICertificateVerification certificate_verifier ) : bool

Add an ICertificateVerification to be called during verification of certificates

AddSignedCertificate ( Mono.Security.X509.X509Certificate cert ) : bool

Adds a local signed public certificate to this CH.

CertificateHandler ( ) : Brunet
CertificateHandler ( string cert_dir ) : Brunet
CertificateHandler ( string cert_dir, string local_id ) : Brunet
FindCertificate ( List supported_cas ) : Mono.Security.X509.X509Certificate

Returns the first certificate that matches one of the CAs listed in the array.

LoadAllCertificates ( ) : void

Loads all the local certificates.

ReadCertificate ( string Filename ) : Mono.Security.X509.X509Certificate

Reads a certificate from a file.

RemoveCertificateVerification ( ICertificateVerification certificate_verifier ) : bool

Remove an ICertificateVerification.

Verify ( Mono.Security.X509.X509Certificate x509, ISender sender ) : bool

True if this certificate is signed by a CA whose cetificate we have, false otherwise.

Verify ( Mono.Security.X509.X509Certificate x509, ISender sender, string remote_id ) : bool

First makes sure we have a CA that supports this certificate, then looks through an x509 certificates SubjectAltName Extension's URI list to determine if the given URI (RemoteID) exists in the certificate.

Verify ( Mono.Security.X509.X509Certificate x509, string remote_id ) : bool

Given a string, this looks inside the certificates SANE to see if the string is present. This isn't inefficient as it looks, there tends to be no entries at most of those places, so this usually has runtime of 1. Also this doesn't actually verify any other properties of the certificate, such as being properly signed.

메소드 상세

AddCACertificate() 공개 메소드

Adds CA certificate to this CH.
public AddCACertificate ( Mono.Security.X509.X509Certificate cert ) : bool
cert Mono.Security.X509.X509Certificate
리턴 bool

AddCertificate() 공개 메소드

public AddCertificate ( string filename ) : bool
filename string
리턴 bool

AddCertificateVerification() 공개 메소드

Add an ICertificateVerification to be called during verification of certificates
public AddCertificateVerification ( ICertificateVerification certificate_verifier ) : bool
certificate_verifier ICertificateVerification
리턴 bool

AddSignedCertificate() 공개 메소드

Adds a local signed public certificate to this CH.
public AddSignedCertificate ( Mono.Security.X509.X509Certificate cert ) : bool
cert Mono.Security.X509.X509Certificate
리턴 bool

CertificateHandler() 공개 메소드

public CertificateHandler ( ) : Brunet
리턴 Brunet

CertificateHandler() 공개 메소드

public CertificateHandler ( string cert_dir ) : Brunet
cert_dir string
리턴 Brunet

CertificateHandler() 공개 메소드

public CertificateHandler ( string cert_dir, string local_id ) : Brunet
cert_dir string
local_id string
리턴 Brunet

FindCertificate() 공개 메소드

Returns the first certificate that matches one of the CAs listed in the array.
public FindCertificate ( List supported_cas ) : Mono.Security.X509.X509Certificate
supported_cas List A list of CAs of which you would like to /// find a certificate that matches.
리턴 Mono.Security.X509.X509Certificate

LoadAllCertificates() 공개 메소드

Loads all the local certificates.
public LoadAllCertificates ( ) : void
리턴 void

ReadCertificate() 공개 메소드

Reads a certificate from a file.
public ReadCertificate ( string Filename ) : Mono.Security.X509.X509Certificate
Filename string
리턴 Mono.Security.X509.X509Certificate

RemoveCertificateVerification() 공개 메소드

Remove an ICertificateVerification.
public RemoveCertificateVerification ( ICertificateVerification certificate_verifier ) : bool
certificate_verifier ICertificateVerification
리턴 bool

Verify() 공개 메소드

True if this certificate is signed by a CA whose cetificate we have, false otherwise.
public Verify ( Mono.Security.X509.X509Certificate x509, ISender sender ) : bool
x509 Mono.Security.X509.X509Certificate
sender ISender
리턴 bool

Verify() 공개 메소드

First makes sure we have a CA that supports this certificate, then looks through an x509 certificates SubjectAltName Extension's URI list to determine if the given URI (RemoteID) exists in the certificate.
public Verify ( Mono.Security.X509.X509Certificate x509, ISender sender, string remote_id ) : bool
x509 Mono.Security.X509.X509Certificate The certificate to check
sender ISender
remote_id string
리턴 bool

Verify() 정적인 공개 메소드

Given a string, this looks inside the certificates SANE to see if the string is present. This isn't inefficient as it looks, there tends to be no entries at most of those places, so this usually has runtime of 1. Also this doesn't actually verify any other properties of the certificate, such as being properly signed.
static public Verify ( Mono.Security.X509.X509Certificate x509, string remote_id ) : bool
x509 Mono.Security.X509.X509Certificate
remote_id string
리턴 bool

프로퍼티 상세

CertDir 공개적으로 프로퍼티

Default directory for storing certificates.
public String CertDir
리턴 String

_cas 보호되어 있는 프로퍼티

Dictionary for authorities local certificates by SerialNumber.
protected Dictionary _cas
리턴 X509Certificate>.Dictionary

_certificate_verifiers 보호되어 있는 프로퍼티

protected List _certificate_verifiers
리턴 List

_lc 보호되어 있는 프로퍼티

Dictionary for local certificates by SerialNumber.
protected Dictionary _lc
리턴 X509Certificate>.Dictionary

_lc_issuers 보호되어 있는 프로퍼티

List of local certificate serial numbers.
protected List _lc_issuers
리턴 List

_local_id 보호되어 있는 프로퍼티

protected string _local_id
리턴 string

_supported_cas 보호되어 있는 프로퍼티

List of supported CAs serial numbers.
protected List _supported_cas
리턴 List

_sync 보호되어 있는 프로퍼티

protected object _sync
리턴 object