mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
This patchset adds: - configure.mac now looks for qmake, backs up xcode project, uses xca.pro to generate a new one, generates a different local.h - mac-package.sh generates a standalone .app bundle for distribution using deployqt from trolltech labs, packages up manual, COPYRIGHT, etc into a .dmg - mac packaging niceties in the qmake project - mac icon file - usability fixes for OS X: - look for user configured oids and such in ~/Library/Preferences/xca if it exists - look for original ones in app bundle/Contents/Resources (it tried to do this before...) - more robust code for getting bundle location (less likely to be broken by Apple in OS revisions) - start browsing for files in ~/Documents - fix wildcards on mac so files without extensions will be opened - fix save behavior for .xdb files so that it's hard to get one that doesn't end in .xdb, as this causes difficulty w/Qt Notes: - one of the compilation fixes was in the new revocation data function that replaced the old macros... I didn't have time to verify that my fix doesn't break when used with 0.9.8. - QStringToAsn1() is clearly incorrect but I haven't yet determined what callers expect, so I just called it out in a comment and did not yet fix it - I added some code that I haven't tested on Windows because I thought it might be a nice function to have there too. I have not added anything to call that function, however, since I don't currently have a machine I can test on :). The code is clearly marked in comments.
101 lines
1.7 KiB
C++
101 lines
1.7 KiB
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 - 2007 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include "x509rev.h"
|
|
|
|
|
|
static X509_REVOKED *X509_REVOKED_dup(const X509_REVOKED *n)
|
|
{
|
|
int len;
|
|
X509_REVOKED *ret;
|
|
unsigned char *buf, *p;
|
|
const unsigned char *cp;
|
|
|
|
len = i2d_X509_REVOKED((X509_REVOKED *)n, NULL);
|
|
buf = (unsigned char *)OPENSSL_malloc(len);
|
|
p = buf;
|
|
i2d_X509_REVOKED((X509_REVOKED *)n, &p);
|
|
cp = buf;
|
|
ret = d2i_X509_REVOKED(NULL, &p, len);
|
|
OPENSSL_free(buf);
|
|
return(ret);
|
|
}
|
|
|
|
x509rev::x509rev()
|
|
{
|
|
rev = X509_REVOKED_new();
|
|
}
|
|
|
|
x509rev::x509rev(const X509_REVOKED *n)
|
|
{
|
|
rev = X509_REVOKED_dup(n);
|
|
}
|
|
|
|
x509rev::x509rev(const x509rev &n)
|
|
{
|
|
rev = NULL;
|
|
set(n.rev);
|
|
}
|
|
|
|
x509rev::~x509rev()
|
|
{
|
|
X509_REVOKED_free(rev);
|
|
}
|
|
|
|
x509rev &x509rev::set(const X509_REVOKED *n)
|
|
{
|
|
if (rev != NULL)
|
|
X509_REVOKED_free(rev);
|
|
rev = X509_REVOKED_dup(n);
|
|
return *this;
|
|
}
|
|
|
|
bool x509rev::operator == (const x509rev &x) const
|
|
{
|
|
return (getSerial() == x.getSerial() &&
|
|
getDate() == x.getDate());
|
|
}
|
|
|
|
x509rev &x509rev::operator = (const x509rev &x)
|
|
{
|
|
set(x.rev);
|
|
return *this;
|
|
}
|
|
|
|
void x509rev::setSerial(const a1int &i)
|
|
{
|
|
if (rev->serialNumber != NULL)
|
|
ASN1_INTEGER_free(rev->serialNumber);
|
|
rev->serialNumber = i.get();
|
|
}
|
|
|
|
void x509rev::setDate(const a1time &t)
|
|
{
|
|
if (rev->revocationDate != NULL)
|
|
ASN1_TIME_free(rev->revocationDate);
|
|
rev->revocationDate = t.get_utc();
|
|
}
|
|
|
|
a1int x509rev::getSerial() const
|
|
{
|
|
a1int a(rev->serialNumber);
|
|
return a;
|
|
}
|
|
|
|
a1time x509rev::getDate() const
|
|
{
|
|
a1time t(rev->revocationDate);
|
|
return t;
|
|
}
|
|
|
|
X509_REVOKED *x509rev::get() const
|
|
{
|
|
return X509_REVOKED_dup(rev);
|
|
}
|
|
|
|
#undef X509_REVOKED
|