* fix version number in exported *.xca template

* fix import of older XCA templates
* Add templates for CA, client and server
This commit is contained in:
Christian 2007-02-07 19:03:34 +01:00
parent 6ef29e0761
commit aa4df24aeb
8 changed files with 34 additions and 26 deletions

View File

@ -1,3 +1,5 @@
* fix version number in exported *.xca template
* fix import of older XCA templates
* add support for predefined templates as there was in 0.5.1
* fix cmdline import of crypto items
* add undelete feature for deleted items

View File

@ -230,7 +230,7 @@ void pki_temp::writeTemp(QString fname)
}
p = toData(&size);
db::intToData(&p1, size);
db::intToData(&p1, version);
db::intToData(&p1, dataVersion);
fwrite(buf, 2*sizeof(int), 1, fp);
fwrite(p, 1, size, fp);
OPENSSL_free(p);
@ -239,7 +239,8 @@ void pki_temp::writeTemp(QString fname)
void pki_temp::loadTemp(QString fname)
{
int size, s;
int size, s, version;
bool oldimport;
unsigned char *p, buf[2*sizeof(int)];
const unsigned char *p1 = buf;
FILE *fp = fopen(CCHAR(fname),"r");
@ -248,19 +249,35 @@ void pki_temp::loadTemp(QString fname)
return;
}
if (fread(buf, 2*sizeof(int), 1, fp) != 1)
openssl_error(tr("Template file content error"));
openssl_error(tr("Template file content error (too small)"));
size = db::intFromData(&p1);
version = db::intFromData(&p1);
if (size > 65535 || size <0)
openssl_error(tr("Template file content error"));
p = (unsigned char *)OPENSSL_malloc(size);
if ((s=fread(p, 1, size, fp)) != size) {
OPENSSL_free(p);
openssl_error(tr("Template file content error"));
if (size > 65535 || size <0) {
fseek(fp, sizeof(int), SEEK_SET);
p1 = buf;
size = intFromData(&p1);
if (size > 65535 || size <0) {
fclose(fp);
openssl_error(tr("Template file content error (bad size)"));
}
oldimport = true;
} else {
oldimport = false;
}
p = (unsigned char *)OPENSSL_malloc(size);
if (p) {
if ((s=fread(p, 1, size, fp)) != size) {
OPENSSL_free(p);
fclose(fp);
openssl_error(tr("Template file content error (bad length)"));
}
}
if (oldimport) {
oldFromData(p, size);
} else {
fromData(p, size, version);
}
fromData(p, size, version);
OPENSSL_free(p);
setIntName(rmslashdot(fname));
@ -291,7 +308,6 @@ int pki_temp::dataSize()
nsCaPolicyUrl.length() +
nsSslServerName.length() +
12 ) * sizeof(char);
//printf("Size of template = %d\n", s);
return s;
}
@ -302,13 +318,6 @@ bool pki_temp::compare(pki_base *ref)
// are stored in the database ...
return false;
}
QString pki_temp::type2Text(int type)
{
QString typec[]={tr("Empty"), tr("CA"), tr("Client"), tr("Server")};
if (type >= 0 && type < 4)
type = 0;
return typec[type];
}
QVariant pki_temp::column_data(int col)
{
@ -329,12 +338,11 @@ QVariant pki_temp::getIcon()
void pki_temp::oldFromData(unsigned char *p, int size )
{
const unsigned char *p1 = p;
int type;
int type, version;
bool dummy;
version=intFromData(&p1);
type=intFromData(&p1);
destination = type2Text(type);
if (version == 1) {
ca = 2;
bool mca = intFromData(&p1);
@ -388,8 +396,5 @@ void pki_temp::oldFromData(unsigned char *p, int size )
if (p1-p != size) {
openssl_error("Wrong Size");
}
//set version to 3
version = 3;
}

View File

@ -86,7 +86,6 @@ class pki_temp: public pki_base
void writeTemp(QString fname);
QVariant column_data(int col);
QVariant getIcon();
QString type2Text(int type);
};
#endif

BIN
misc/CA.xca Normal file

Binary file not shown.

BIN
misc/HTTPS_client.xca Normal file

Binary file not shown.

BIN
misc/HTTPS_server.xca Normal file

Binary file not shown.

View File

@ -4,7 +4,7 @@ all:
install:
install -m 755 -d $(destdir)$(prefix)/share/xca/ \
$(destdir)$(prefix)/share/applications
install -m 644 *.txt $(destdir)$(prefix)/share/xca
install -m 644 *.txt *.xca $(destdir)$(prefix)/share/xca
install -m 644 xca.desktop $(destdir)$(prefix)/share/applications
app:

View File

@ -64,6 +64,7 @@ Section "xca (required)" SecMain
File "misc\eku.txt"
File "misc\oids.txt"
File "misc\aia.txt"
File "misc\*.xca"
File /nonfatal "lang\*.qm"
File "doc\*.html"
File "${BDIR}\mingwm10.dll"
@ -142,6 +143,7 @@ Section "Uninstall"
Delete $INSTDIR\key.ico
Delete $INSTDIR\key.xpm
Delete $INSTDIR\*.dll
Delete $INSTDIR\*.xca
Delete $INSTDIR\*.txt
Delete $INSTDIR\*.qm
Delete $INSTDIR\*.html