rv = SEC_ASN1DecodeItem(arena, lpk, keyTemplate, &pki->privateKey);
rv = SEC_QuickDERDecodeItem(arena, lpk, keyTemplate, &pki->privateKey);
PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot,	SECKEYPrivateKeyInfo *pki, SECItem *nickname, SECItem *publicValue,	PRBool isPerm, PRBool isPrivate, unsigned int keyUsage,	SECKEYPrivateKey **privk, void *wincx) {    CK_KEY_TYPE keyType = CKK_RSA;    SECStatus rv = SECFailure;    SECKEYRawPrivateKey *lpk = NULL;    const SEC_ASN1Template *keyTemplate, *paramTemplate;    void *paramDest = NULL;    PRArenaPool *arena;    arena = PORT_NewArena(2048);    if(!arena) {	return SECFailure;    }    /* need to change this to use RSA/DSA keys */    lpk = (SECKEYRawPrivateKey *)PORT_ArenaZAlloc(arena,						  sizeof(SECKEYRawPrivateKey));    if(lpk == NULL) {	goto loser;    }    lpk->arena = arena;    switch(SECOID_GetAlgorithmTag(&pki->algorithm)) {	case SEC_OID_PKCS1_RSA_ENCRYPTION:	    prepare_rsa_priv_key_export_for_asn1(lpk);	    keyTemplate = SECKEY_RSAPrivateKeyExportTemplate;	    paramTemplate = NULL;	    paramDest = NULL;	    lpk->keyType = rsaKey;	    keyType = CKK_RSA;	    break;	case SEC_OID_ANSIX9_DSA_SIGNATURE:	    prepare_dsa_priv_key_export_for_asn1(lpk);	    keyTemplate = SECKEY_DSAPrivateKeyExportTemplate;	    paramTemplate = SECKEY_PQGParamsTemplate;	    paramDest = &(lpk->u.dsa.params);	    lpk->keyType = dsaKey;	    keyType = CKK_DSA;	    break;	case SEC_OID_X942_DIFFIE_HELMAN_KEY:	    if(!publicValue) {		goto loser;	    }	    prepare_dh_priv_key_export_for_asn1(lpk);	    keyTemplate = SECKEY_DHPrivateKeyExportTemplate;	    paramTemplate = NULL;	    paramDest = NULL;	    lpk->keyType = dhKey;	    keyType = CKK_DH;	    break;	default:	    keyTemplate   = NULL;	    paramTemplate = NULL;	    paramDest     = NULL;	    break;    }    if(!keyTemplate) {	goto loser;    }    /* decode the private key and any algorithm parameters */    rv = SEC_ASN1DecodeItem(arena, lpk, keyTemplate, &pki->privateKey);    if(rv != SECSuccess) {	goto loser;    }    if(paramDest && paramTemplate) {	rv = SEC_ASN1DecodeItem(arena, paramDest, paramTemplate, 				 &(pki->algorithm.parameters));	if(rv != SECSuccess) {	    goto loser;	}    }    rv = PK11_ImportAndReturnPrivateKey(slot,lpk,nickname,publicValue, isPerm, 	isPrivate,  keyUsage, privk, wincx);loser:    if (lpk!= NULL) {	PORT_FreeArena(arena, PR_TRUE);    }    return rv;}