kipkcrpr.c revision 40f53fa8d9c6a4fc38c0014495e7a42b08f52481
/* Copyright (C) RSA Data Security, Inc. created 1990, 1996. This is an
unpublished work protected as such under copyright law. This work
contains proprietary, confidential, and trade secret information of
RSA Data Security, Inc. Use, disclosure or reproduction without the
express written authorization of RSA Data Security, Inc. is
prohibited.
*/
#include "global.h"
#include "bsafe2.h"
#include "bkey.h"
#include "kinfotyp.h"
#include "intitem.h"
#include "kifulprv.h"
#include "kipkcrpr.h"
static ITEM *PKCS_RSA_PRIVATE_KEY_ITEMS[] = {
};
{
/* Return 1 to indicate a KeyInfoType, not an AlgorithmInfoType */
return (1);
}
{
int status;
/* Allocate memory for A_PKCS_RSA_PRIVATE_KEY struct and copy integers
from supplied value.
*/
if ((status = B_MemoryPoolAlloc
sizeof (A_PKCS_RSA_PRIVATE_KEY))) != 0)
return (status);
if ((status = AllocAndCopyIntegerItems
PKCS_RSA_PRIVATE_KEY_ITEMS, sizeof (PKCS_RSA_PRIVATE_KEY_ITEMS) /
!= 0)
return (status);
/* Cache the full private key info.
*/
if ((status = CacheFullPrivateKey
&newValue->coefficient)) != 0)
return (status);
return (B_InfoCacheAddInfo
}
{
int status;
/* If not already found in the cache, try to get values from
a full private key info.
*/
if ((status = GetFullPrivateKeyInfo
return (status);
/* Got all the needed fields, so allocate memory for a new
A_PKCS_RSA_PRIVATE_KEY struct and copy the key value.
*/
if ((status = B_MemoryPoolAlloc
!= 0)
return (status);
return (0);
}