/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <assert.h>
#include <strings.h>
#include <kmfapi.h>
#include "kssladm.h"
/*
* Extract the Certificate and raw key data from a PKCS#12 file.
* The password needed for decrypting the PKCS#12 PDU is stored
* in plaintext in the given "password_file" parameter.
*/
int
const char *filename, const char *password_file,
{
ncerts = 0;
nkeys = 0;
sizeof (password_buf)) <= 0) {
perror("Unable to read passphrase");
goto done;
}
}
done:
int i;
for (i = 0; i < ncerts; i++)
}
ncerts = 0;
for (i = 0; i < nkeys; i++)
kmf_free_raw_key(&keys[i]);
}
}
return (ncerts);
}
/*
* Parse a PEM file which should contain RSA private keys and
* their associated X.509v3 certificates. More than 1 may
* be present in the file.
*/
int
const char *filename, char *password_file,
{
ncerts = 0;
nkeys = 0;
sizeof (password_buf)) <= 0) {
perror("Unable to read passphrase");
goto done;
}
}
done:
int i;
for (i = 0; i < ncerts; i++)
}
ncerts = 0;
for (i = 0; i < nkeys; i++)
kmf_free_raw_key(&keys[i]);
}
}
return (ncerts);
}