small fixes

This commit is contained in:
chris2511 2005-05-23 18:23:19 +00:00
parent 8f9f615713
commit d80d1ff6d2
14 changed files with 59 additions and 51 deletions

View File

@ -15,7 +15,7 @@ CLEANDIRS=lang doc
bindir=bin
all: headers xca doc
all: headers xca docs
re: clean all
xca.o: $(OBJECTS)
@ -25,6 +25,8 @@ xca: xca.o
$(CC) $(LDFLAGS) $< $(LIBS) -o $@
@echo -e "\n\n\nOk, compilation was successfull. \nNow do as root: 'make install'\n"
docs:
$(MAKE) -C doc
headers:
$(MAKE) -C ui $@
@ -32,13 +34,8 @@ headers:
$(MAKE) DEP=yes -C $* target.obj
clean:
for x in $(SUBDIRS); do \
$(MAKE) -C $${x} clean; \
done
for x in $(CLEANDIRS); do \
$(MAKE) -C $${x} clean; \
done
rm -f *~ xca
for x in $(SUBDIRS) $(CLEANDIRS); do $(MAKE) -C $${x} clean; done
rm -f *~ xca xca.o
distclean: clean
rm -f Local.mak conftest conftest.log

3
configure vendored
View File

@ -73,6 +73,7 @@ search_includes() {
for dbn in "" ${subdirs}; do
if test -r ${dir}/include${dbn}/$1; then
add_include ${dir}/include${dbn}
test -z "${dbn}" || add_include ${dir}/include
echo Found: $1 at ${dir}/include${dbn}
return 0
fi
@ -166,7 +167,7 @@ echo
echo "LDFLAGS :${LIBS}${LDIRS}"
echo "PREFIX :${prefix:=/usr/local}"
echo "CPPFLAGS :${CF}"
echo "CFLAGS :${CFLAGS:=-Wall -g}"
echo "CFLAGS :${CFLAGS:=-Wall -g -ggdb}"
echo
cat >Local.mak <<EOF

View File

@ -97,7 +97,7 @@ a1time &a1time::set(const ASN1_TIME *a)
ASN1_TIME *siko = time;
time = ASN1_TIME_to_generalizedtime((ASN1_TIME *)a, &siko);
if (!time) {
if (siko) ASN1_TIME_free(time);
if (siko) ASN1_TIME_free(siko);
time=M_ASN1_TIME_dup(a);
}
}

View File

@ -157,6 +157,12 @@ pki_key::pki_key(const pki_key *pk)
init();
openssl_error();
if (pk == NULL) return;
printf("EVP_PKEY_COPY (no error)\n");
if (pk->key->type == EVP_PKEY_RSA)
EVP_PKEY_assign_RSA(key, EVP_PKEY_get1_RSA(pk->key));
if (pk->key->type == EVP_PKEY_DSA)
EVP_PKEY_assign_DSA(key, EVP_PKEY_get1_DSA(pk->key));
#if 0
key->type = pk->key->type;
if (key->type == EVP_PKEY_RSA) {
//rsakey = RSA_dup(pk->key->pkey.rsa);
@ -165,7 +171,7 @@ pki_key::pki_key(const pki_key *pk)
if (key->type == EVP_PKEY_DSA) {
key->pkey.dsa=((DSA *)ASN1_dup( (int(*)())i2d_DSAPrivateKey, (char *(*)())d2i_DSAPrivateKey,(char *)pk->key->pkey.dsa));
}
#endif
openssl_error();
encryptKey();
}
@ -309,6 +315,7 @@ void pki_key::oldFromData(const unsigned char *p, int size )
OPENSSL_free(pdec);
EVP_CIPHER_CTX_cleanup(&ctx);
openssl_error();
encryptKey();
}
EVP_PKEY *pki_key::decryptKey()
@ -507,34 +514,35 @@ void pki_key::writeKey(const QString fname, const EVP_CIPHER *enc,
}
FILE *fp = fopen(fname.latin1(), "w");
if (fp != NULL) {
if (key){
pkey = decryptKey();
if (PEM) {
PEM_write_PrivateKey(fp, pkey, enc, NULL, 0, cb, &p);
} else {
i2d_PrivateKey_fp(fp, pkey);
}
EVP_PKEY_free(pkey);
openssl_error();
}
fopen_error(fname);
return;
}
if (key){
pkey = decryptKey();
if (PEM) {
PEM_write_PrivateKey(fp, pkey, enc, NULL, 0, cb, &p);
} else {
i2d_PrivateKey_fp(fp, pkey);
}
EVP_PKEY_free(pkey);
openssl_error();
}
else fopen_error(fname);
fclose(fp);
}
void pki_key::writePublic(const QString fname, bool PEM)
{
FILE *fp = fopen(fname.latin1(),"w");
if (fp != NULL) {
if (key->type == EVP_PKEY_RSA) {
if (PEM)
PEM_write_PUBKEY(fp, key);
else
i2d_PUBKEY_fp(fp, key);
openssl_error();
}
if (fp == NULL) {
fopen_error(fname);
return;
}
else fopen_error(fname);
if (PEM)
PEM_write_PUBKEY(fp, key);
else
i2d_PUBKEY_fp(fp, key);
openssl_error();
fclose(fp);
}
@ -542,9 +550,13 @@ void pki_key::writePublic(const QString fname, bool PEM)
QString pki_key::length()
{
char st[64];
QString x;
if (key->type == EVP_PKEY_DSA && key->pkey.dsa->p==NULL) {
return x="???";
}
sprintf(st,"%i bit", EVP_PKEY_bits(key) );
openssl_error();
QString x = st;
x = st;
return x;
}

View File

@ -123,8 +123,6 @@ QString x509name::getEntry(int i) const
else
ret=QString::fromLatin1((const char *)d->data,d->length);
//ASN1_STRING_free(d);
return ret;
}

View File

@ -3073,7 +3073,7 @@ Example:
<customwidgets>
<customwidget>
<class>Validity</class>
<header location="local">validity.h</header>
<header location="global">widgets/validity.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>

View File

@ -48,8 +48,8 @@
*
*/
#ifndef CERTDETAIL_H
#define CERTDETAIL_H
#ifndef __CERTDETAIL_H
#define __CERTDETAIL_H
#include "ui/CertDetail.h"

View File

@ -48,8 +48,8 @@
*
*/
#ifndef CERTEXTEND_H
#define CERTEXTEND_H
#ifndef __CERTEXTEND_H
#define __CERTEXTEND_H
#include "ui/CertExtend.h"

View File

@ -48,8 +48,8 @@
*
*/
#ifndef CRLDETAIL_H
#define CRLDETAIL_H
#ifndef __CRLDETAIL_H
#define __CRLDETAIL_H
#include "ui/CrlDetail.h"

View File

@ -48,8 +48,8 @@
*
*/
#ifndef EXPORTCERT_H
#define EXPORTCERT_H
#ifndef __EXPORTCERT_H
#define __EXPORTCERT_H
#include "ui/ExportCert.h"

View File

@ -48,8 +48,8 @@
*
*/
#ifndef EXPORTKEY_H
#define EXPORTKEY_H
#ifndef __EXPORTKEY_H
#define __EXPORTKEY_H
#include "ui/ExportKey.h"

View File

@ -49,8 +49,8 @@
*
*/
#ifndef IMPORTMULTI_H
#define IMPORTMULTI_H
#ifndef __IMPORTMULTI_H
#define __IMPORTMULTI_H
#include "ui/ImportMulti.h"
#include "lib/pki_base.h"

View File

@ -48,8 +48,8 @@
*
*/
#ifndef KEYDETAIL_H
#define KEYDETAIL_H
#ifndef __KEYDETAIL_H
#define __KEYDETAIL_H
#include "ui/KeyDetail.h"

View File

@ -49,8 +49,8 @@
*/
#ifndef NEWX509_H
#define NEWX509_H
#ifndef __NEWX509_H
#define __NEWX509_H
#include "ui/NewX509.h"
#include "lib/oid.h"