32 #include <tdetempfile.h> 38 #define sk_new kossl->sk_new 39 #define sk_push kossl->sk_push 40 #define sk_free kossl->sk_free 41 #define sk_value kossl->sk_value 42 #define sk_num kossl->sk_num 43 #define sk_dup kossl->sk_dup 47 KSSLPKCS7::KSSLPKCS7() {
50 kossl = KOSSL::self();
57 if (_pkcs) kossl->PKCS7_free(_pkcs);
59 if (_cert)
delete _cert;
67 if (base64.isEmpty())
return NULL;
68 TQByteArray qba, qbb = TQCString(base64.latin1()).copy();
69 KCodecs::base64Decode(qbb, qba);
70 ktf.file()->writeBlock(qba);
84 PKCS7 *newpkcs = NULL;
86 if (!qf.open(IO_ReadOnly))
89 FILE *fp = fdopen(qf.handle(),
"r");
92 newpkcs = KOSSL::self()->d2i_PKCS7_fp(fp, &newpkcs);
94 if (!newpkcs)
return NULL;
131 len = kossl->i2d_PKCS7(_pkcs, NULL);
133 char *buf =
new char[len];
134 p = (
unsigned char *)buf;
135 kossl->i2d_PKCS7(_pkcs, &p);
137 qba.setRawData(buf, len);
138 base64 = KCodecs::base64Encode(qba);
139 qba.resetRawData(buf, len);
150 TQFile out(filename);
152 if (!out.open(IO_WriteOnly))
return false;
154 int fd = out.handle();
155 FILE *fp = fdopen(fd,
"w");
158 unlink(filename.latin1());
162 kossl->i2d_PKCS7_fp(fp, _pkcs);
176 return KSSLCertificate::NoSSL;
184 return KSSLCertificate::Unknown;
189 return (
validate() == KSSLCertificate::Ok);
KSSLValidation validate()
Check if this is a valid certificate.
KSSLValidation revalidate()
Check if this is a valid certificate.
KSSLCertChain * getChain()
Get the certificate chain.
bool toFile(TQString filename)
Write the PKCS#7 to a file in raw mode.
bool isValid()
Return true if the chain is valid.
KDE Certificate Chain Representation Class.
static KSSLPKCS7 * fromString(TQString base64)
Create a KSSLPKCS7 object from a Base64 in a TQString.
KSSLValidation
A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certi...
KSSLCertificate::KSSLValidation validate()
Check the chain to make sure it's valid.
KSSLCertificate::KSSLValidation revalidate()
Check the chain to make sure it's valid.
KSSLCertificate * getCertificate()
Get the bottom level X.509 certificate.
TQString name()
The name of this certificate.
void setCert(PKCS7 *c)
Raw set the PKCS7 object.
static KSSLPKCS7 * loadCertFile(TQString filename)
Create a KSSLPKCS7 object by reading a PKCS#7 file.
virtual ~KSSLPKCS7()
Destroy this PKCS#7 certificate.
TQString getSubject() const
Get the subject of the certificate (X.509 map).
TQString toString()
Convert to a Base64 string.