|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.network.QSslCertificate
public class QSslCertificate
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 notValidBefore() and notValidAfter() to check when the certificate was issued, 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.
QSslSocket
, QSslKey
, QSslCipher
, and QSslError
.
Nested Class Summary | |
---|---|
static class |
QSslCertificate.SubjectInfo
Describes keys that you can pass to QSslCertificate::issuerInfo() or QSslCertificate::subjectInfo() to get information about the certificate issuer or subject. |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QSslCertificate()
Constructs a QSslCertificate by parsing the format encoded data and using the first available certificate found. |
|
QSslCertificate(QByteArray encoded)
Constructs a QSslCertificate by parsing the format encoded data and using the first available certificate found. |
|
QSslCertificate(QByteArray encoded,
QSsl.EncodingFormat format)
Constructs a QSslCertificate by parsing the format encoded data and using the first available certificate found. |
|
QSslCertificate(QIODevice device)
Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. |
|
QSslCertificate(QIODevice device,
QSsl.EncodingFormat format)
Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. |
|
QSslCertificate(QSslCertificate other)
Constructs an identical copy of other. |
Method Summary | |
---|---|
java.util.SortedMap |
alternateSubjectNames()
Returns the list of alternative subject names for this certificate. |
void |
clear()
Clears the contents of this certificate, making it a null certificate. |
QSslCertificate |
clone()
This method is reimplemented for internal reasons |
QByteArray |
digest()
Returns a cryptographic digest of this certificate. |
QByteArray |
digest(QCryptographicHash.Algorithm algorithm)
Returns a cryptographic digest of this certificate. |
QDateTime |
effectiveDate()
Returns the date-time that the certificate becomes valid, or an empty QDateTime if this is a null certificate. |
QDateTime |
expiryDate()
Returns the date-time that the certificate expires, or an empty QDateTime if this is a null certificate. |
static java.util.List |
fromData(QByteArray data)
Searches for and parses all certificates in data that are encoded in the specified format and returns them in a list of certificates. |
static java.util.List |
fromData(QByteArray data,
QSsl.EncodingFormat format)
Searches for and parses all certificates in data that are encoded in the specified format and returns them in a list of certificates. |
static java.util.List |
fromDevice(QIODevice device)
Searches for and parses all certificates in device that are encoded in the specified format and returns them in a list of certificates. |
static java.util.List |
fromDevice(QIODevice device,
QSsl.EncodingFormat format)
Searches for and parses all certificates in device that are encoded in the specified format and returns them in a list of certificates. |
static java.util.List |
fromPath(java.lang.String path)
Searches all files in the path for certificates encoded in the specified format and returns them in a list. |
static java.util.List |
fromPath(java.lang.String path,
QSsl.EncodingFormat format)
Searches all files in the path for certificates encoded in the specified format and returns them in a list. |
static java.util.List |
fromPath(java.lang.String path,
QSsl.EncodingFormat format,
QRegExp.PatternSyntax syntax)
Searches all files in the path for certificates encoded in the specified format and returns them in a list. |
long |
handle()
Returns a pointer to the native certificate handle, if there is one, or a null pointer otherwise. |
boolean |
isNull()
Returns true if this is a null certificate (i. |
java.lang.String |
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. |
java.lang.String |
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. |
boolean |
isValid()
Returns true if this certificate is valid; otherwise returns false. |
QSslKey |
publicKey()
Returns the certificate subject's public key. |
QByteArray |
serialNumber()
Returns the certificate's serial number string. |
java.lang.String |
subjectInfo(QByteArray tag)
Returns the subject information for tag, or an empty string if there is no information for tag in the certificate. |
java.lang.String |
subjectInfo(QSslCertificate.SubjectInfo info)
Returns the information for the subject, or an empty string if there is no information for subject in the certificate. |
QByteArray |
toDer()
Returns this certificate converted to a DER (binary) encoded representation. |
QByteArray |
toPem()
Returns this certificate converted to a PEM (Base64) encoded representation. |
java.lang.String |
toString()
|
QByteArray |
version()
Returns the certificate's version string. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QSslCertificate(QIODevice device)
isNull()
to see if device contained a certificate, and if this certificate was loaded successfully.
public QSslCertificate(QIODevice device, QSsl.EncodingFormat format)
isNull()
to see if device contained a certificate, and if this certificate was loaded successfully.
public QSslCertificate(QByteArray encoded)
isNull()
to see if data contained a certificate, and if this certificate was loaded successfully.
public QSslCertificate()
isNull()
to see if data contained a certificate, and if this certificate was loaded successfully.
public QSslCertificate(QByteArray encoded, QSsl.EncodingFormat format)
isNull()
to see if data contained a certificate, and if this certificate was loaded successfully.
public QSslCertificate(QSslCertificate other)
Method Detail |
---|
public final java.util.SortedMap alternateSubjectNames()
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.
subjectInfo()
.
public final void clear()
isNull()
.
public final QByteArray digest()
public final QByteArray digest(QCryptographicHash.Algorithm algorithm)
public final QDateTime effectiveDate()
QDateTime
if this is a null certificate. expiryDate()
.
public final QDateTime expiryDate()
QDateTime
if this is a null certificate. effectiveDate()
.
public final long handle()
You can use this handle, together with the native API, to access extended information about the certificate.
Warning: Use of this function has a high probability of being non-portable, and its return value may vary from platform to platform or change from minor release to minor release.
public final boolean isNull()
By default, QSslCertificate constructs a null certificate.
isValid()
, and clear()
.
public final boolean isValid()
Note: Currently, this function only checks that the current data-time is within the date-time range during which the certificate is considered valid. No other checks are currently performed.
isNull()
.
public final java.lang.String issuerInfo(QSslCertificate.SubjectInfo info)
subjectInfo()
.
public final java.lang.String issuerInfo(QByteArray tag)
subjectInfo()
.
public final QSslKey publicKey()
public final QByteArray serialNumber()
public final java.lang.String subjectInfo(QSslCertificate.SubjectInfo info)
issuerInfo()
.
public final java.lang.String subjectInfo(QByteArray tag)
issuerInfo()
.
public final QByteArray toDer()
public final QByteArray toPem()
public final QByteArray version()
public static java.util.List fromData(QByteArray data)
fromDevice()
.
public static java.util.List fromData(QByteArray data, QSsl.EncodingFormat format)
fromDevice()
.
public static java.util.List fromDevice(QIODevice device)
fromData()
.
public static java.util.List fromDevice(QIODevice device, QSsl.EncodingFormat format)
fromData()
.
public static java.util.List fromPath(java.lang.String path, QSsl.EncodingFormat format)
Example:
for (QSslCertificate cert : QSslCertificate.fromPath("C:/ssl/certificate.*.pem", QRegExp.Wildcard)) { qDebug() << cert.issuerInfo(QSslCertificate.Organization); }
fromData()
.
public static java.util.List fromPath(java.lang.String path)
Example:
for (QSslCertificate cert : QSslCertificate.fromPath("C:/ssl/certificate.*.pem", QRegExp.Wildcard)) { qDebug() << cert.issuerInfo(QSslCertificate.Organization); }
fromData()
.
public static java.util.List fromPath(java.lang.String path, QSsl.EncodingFormat format, QRegExp.PatternSyntax syntax)
Example:
for (QSslCertificate cert : QSslCertificate.fromPath("C:/ssl/certificate.*.pem", QRegExp.Wildcard)) { qDebug() << cert.issuerInfo(QSslCertificate.Organization); }
fromData()
.
public java.lang.String toString()
toString
in class java.lang.Object
public QSslCertificate clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |