Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
-#include "silc.h"
+#include "silccrypto.h"
#include "silcpk_i.h"
/****************************** Key generation *******************************/
int len;
/* Protocol says that at least UN and HN must be provided as identifier */
- if (!strstr(identifier, "UN=") && !strstr(identifier, "HN=")) {
+ if (!strstr(identifier, "UN=") || !strstr(identifier, "HN=")) {
SILC_LOG_DEBUG(("The public does not have the required UN= and HN= "
"identifiers"));
return FALSE;
SilcBufferStruct buf;
char *identifier;
- if (!username || !host)
+ if (!username || !host) {
+ SILC_LOG_ERROR(("Public key identifier is missing UN and/or HN"));
return NULL;
+ }
if (strlen(username) < 1 || strlen(host) < 1)
return NULL;
if (version) {
if (strlen(version) > 1 || !isdigit(version[0])) {
silc_buffer_spurge(stack, &buf);
+ SILC_LOG_ERROR(("Public key identifier has invalid version (V)"));
return NULL;
}
silc_buffer_sformat(stack, &buf,
silc_cipher_free(aes);
/* Import the private key */
- ret = silc_pkcs_silc_import_private_key(pkcs, NULL, filedata,
+ ret = silc_pkcs_silc_import_private_key(pkcs, NULL, NULL, 0, filedata,
len, ret_private_key, ret_alg);
silc_free(data);