Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtNetwork.QSslCertificate Class Reference

The QSslCertificate class provides a convenient API for an X509 certificate. More...

Inheritance diagram for QtNetwork.QSslCertificate:
Collaboration diagram for QtNetwork.QSslCertificate:

Public Types

enum  SubjectInfo {
  CommonName = 1, CountryName = 4, LocalityName = 2, Organization = 0,
  OrganizationalUnitName = 3, StateOrProvinceName = 5
}
  More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QSslCertificate ()
 
 
 QSslCertificate (QSslCertificate other)
 
 
 QSslCertificate (QIODevice device, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
 QSslCertificate (QByteArray encoded, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
virtual void CreateProxy ()
 
new
System.Collections.Generic.Dictionary
< QSsl.AlternateNameEntryType,
System.String > 
AlternateSubjectNames ()
 
 
new void Clear ()
 
 
new QByteArray Digest (QCryptographicHash.Algorithm algorithm=QCryptographicHash.Algorithm.Md5)
 
 
new QDateTime EffectiveDate ()
 
 
new QDateTime ExpiryDate ()
 
 
new bool IsNull ()
 
 
new bool IsValid ()
 
 
new string IssuerInfo (QByteArray tag)
 
 
new string IssuerInfo (QSslCertificate.SubjectInfo info)
 
 
new QSslKey PublicKey ()
 
 
new QByteArray SerialNumber ()
 
 
new string subjectInfo (QByteArray tag)
 
 
new string subjectInfo (QSslCertificate.SubjectInfo info)
 
 
new QByteArray ToDer ()
 
 
new QByteArray ToPem ()
 
 
new QByteArray Version ()
 
 
new void Dispose ()
 

Static Public Member Functions

static
System.Collections.Generic.List
< QSslCertificate
FromData (QByteArray data, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
static
System.Collections.Generic.List
< QSslCertificate
FromDevice (QIODevice device, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
static
System.Collections.Generic.List
< QSslCertificate
FromPath (string path, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem, QRegExp.PatternSyntax syntax=QRegExp.PatternSyntax.FixedString)
 
 
static bool operator!= (QSslCertificate arg1, QSslCertificate arg2)
 
 
static bool operator== (QSslCertificate arg1, QSslCertificate arg2)
 
 

Protected Member Functions

 QSslCertificate (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QSslCertificate class provides a convenient API for an X509 certificate.

QSslCertificate stores an X509 certificate, and is commonly used to verify the identity and store information about the local host, a remotely connected peer, or a trusted third party Certificate Authority.

There are many ways to construct a QSslCertificate. The most common way is to call QSslSocket::peerCertificate(), which returns a QSslCertificate object, or QSslSocket::peerCertificateChain(), which returns a list of them. You can also load certificates from a DER (binary) or PEM (Base64) encoded bundle, typically stored as one or more local files, or in a Qt Resource.

You can call isNull() to check if your certificate is null. By default, QSslCertificate constructs a null certificate. To check if the certificate is valid, call isValid(). A null certificate is invalid, but an invalid certificate is not necessarily null. If you want to reset all contents in a certificate, call clear().

After loading a certificate, you can find information about the certificate, its subject, and its issuer, by calling one of the many accessor functions, including version(), serialNumber(), issuerInfo() and subjectInfo(). You can call effectiveDate() and expiryDate() to check when the certificate starts being effective and when it expires. The publicKey() function returns the certificate subject's public key as a QSslKey. You can call issuerInfo() or subjectInfo() to get detailed information about the certificate issuer and its subject.

Internally, QSslCertificate is stored as an X509 structure. You can access this handle by calling handle(), but the results are likely to not be portable.

See also QSslSocket, QSslKey, QSslCipher, and QSslError.

Member Enumeration Documentation

Describes keys that you can pass to QSslCertificate::issuerInfo() or QSslCertificate::subjectInfo() to get information about the certificate issuer or subject.

Enumerator:
CommonName 

"CN" The common name; most often this is used to store the host name.

CountryName 

"C" The country.

LocalityName 

"L" The locality.

Organization 

"O" The name of the organization.

OrganizationalUnitName 

"OU" The organizational unit name.

StateOrProvinceName 

"ST" The state or province.

Constructor & Destructor Documentation

QtNetwork.QSslCertificate.QSslCertificate ( System.Type  dummy)
protected
QtNetwork.QSslCertificate.QSslCertificate ( )

Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. You can later call isNull() to see if device contained a certificate, and if this certificate was loaded successfully.

QtNetwork.QSslCertificate.QSslCertificate ( QSslCertificate  other)

Constructs an identical copy of other.

QtNetwork.QSslCertificate.QSslCertificate ( QIODevice  device,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)

Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. You can later call isNull() to see if device contained a certificate, and if this certificate was loaded successfully.

QtNetwork.QSslCertificate.QSslCertificate ( QByteArray  encoded,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)

Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. You can later call isNull() to see if device contained a certificate, and if this certificate was loaded successfully.

Member Function Documentation

new System.Collections.Generic.Dictionary<QSsl.AlternateNameEntryType,System.String> QtNetwork.QSslCertificate.AlternateSubjectNames ( )

Returns the list of alternative subject names for this certificate. The alternate subject names typically contain host names, optionally with wildcards, that are valid for this certificate.

These names are tested against the connected peer's host name, if either the subject information for CommonName doesn't define a valid host name, or the subject info name doesn't match the peer's host name.

See also subjectInfo().

new void QtNetwork.QSslCertificate.Clear ( )

Clears the contents of this certificate, making it a null certificate.

See also isNull().

virtual void QtNetwork.QSslCertificate.CreateProxy ( )
virtual
new QByteArray QtNetwork.QSslCertificate.Digest ( QCryptographicHash.Algorithm  algorithm = QCryptographicHash.Algorithm.Md5)

Returns a cryptographic digest of this certificate. By default, an MD5 digest will be generated, but you can also specify a custom algorithm.

new void QtNetwork.QSslCertificate.Dispose ( )
new QDateTime QtNetwork.QSslCertificate.EffectiveDate ( )

Returns the date-time that the certificate becomes valid, or an empty QDateTime if this is a null certificate.

See also expiryDate().

override bool QtNetwork.QSslCertificate.Equals ( object  o)
new QDateTime QtNetwork.QSslCertificate.ExpiryDate ( )

Returns the date-time that the certificate expires, or an empty QDateTime if this is a null certificate.

See also effectiveDate().

static System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslCertificate.FromData ( QByteArray  data,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)
static

Searches for and parses all certificates in data that are encoded in the specified format and returns them in a list of certificates.

See also fromDevice().

static System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslCertificate.FromDevice ( QIODevice  device,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)
static

Searches for and parses all certificates in device that are encoded in the specified format and returns them in a list of certificates.

See also fromData().

static System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslCertificate.FromPath ( string  path,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem,
QRegExp.PatternSyntax  syntax = QRegExp.PatternSyntax.FixedString 
)
static

Searches all files in the path for certificates encoded in the specified format and returns them in a list. must be a file or a pattern matching one or more files, as specified by syntax.

Example:

foreach (const QSslCertificate &cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,

QRegExp::Wildcard)) {

qDebug() << cert.issuerInfo(QSslCertificate::Organization);

}

See also fromData().

override int QtNetwork.QSslCertificate.GetHashCode ( )
new bool QtNetwork.QSslCertificate.IsNull ( )

Returns true if this is a null certificate (i.e., a certificate with no contents); otherwise returns false.

By default, QSslCertificate constructs a null certificate.

See also isValid() and clear().

new string QtNetwork.QSslCertificate.IssuerInfo ( QByteArray  tag)

Returns the issuer information for tag from the certificate, or an empty string if there is no information for tag in the certificate.

See also subjectInfo().

new string QtNetwork.QSslCertificate.IssuerInfo ( QSslCertificate.SubjectInfo  info)

Returns the issuer information for the subject from the certificate, or an empty string if there is no information for subject in the certificate.

See also subjectInfo().

new bool QtNetwork.QSslCertificate.IsValid ( )

Returns true if this certificate is valid; otherwise returns false.

Note: Currently, this function checks that the current data-time is within the date-time range during which the certificate is considered valid, and checks that the certificate is not in a blacklist of fraudulent certificates.

See also isNull().

static bool QtNetwork.QSslCertificate.operator!= ( QSslCertificate  arg1,
QSslCertificate  arg2 
)
static

Returns true if this certificate is not the same as other; otherwise returns false.

static bool QtNetwork.QSslCertificate.operator== ( QSslCertificate  arg1,
QSslCertificate  arg2 
)
static

Returns true if this certificate is the same as other; otherwise returns false.

new QSslKey QtNetwork.QSslCertificate.PublicKey ( )

Returns the certificate subject's public key.

new QByteArray QtNetwork.QSslCertificate.SerialNumber ( )

Returns the certificate's serial number string in decimal format. In case the serial number cannot be converted to decimal format (i.e. if it is bigger than 4294967295, which means it does not fit into 4 bytes), its hexadecimal version is returned.

new string QtNetwork.QSslCertificate.subjectInfo ( QByteArray  tag)

Returns the subject information for tag, or an empty string if there is no information for tag in the certificate.

See also issuerInfo().

new string QtNetwork.QSslCertificate.subjectInfo ( QSslCertificate.SubjectInfo  info)

Returns the information for the subject, or an empty string if there is no information for subject in the certificate.

See also issuerInfo().

new QByteArray QtNetwork.QSslCertificate.ToDer ( )

Returns this certificate converted to a DER (binary) encoded representation.

new QByteArray QtNetwork.QSslCertificate.ToPem ( )

Returns this certificate converted to a PEM (Base64) encoded representation.

new QByteArray QtNetwork.QSslCertificate.Version ( )

Returns the certificate's version string.

Member Data Documentation

SmokeInvocation QtNetwork.QSslCertificate.interceptor
protected

Property Documentation

virtual System.IntPtr QtNetwork.QSslCertificate.SmokeObject
getset