[Fwd: [xmlsec] Loading PEM keys from memory instead of a file]

Aleksey Sanin aleksey@aleksey.com
Fri, 24 Jan 2003 15:06:23 -0800


You need to create DSA key first and next set a value:

    DSA * dsa = NULL;   
    xmlSecKeyPtr key;   
    int ret;

    /* create DSA key */
    dsa = .....

    /* create xmlSecKey */
    key = xmlSecKeyCreate(xmlSecDsaKey, xmlSecKeyOriginDefault);
    if(key == NULL) {
        fprintf(stderr, "Error: failed to create dsa key\n");
        return(NULL);
    }       
    
    /* set value */
    ret = xmlSecDsaKeyGenerate(key, dsa);
    if(ret < 0) {
        xmlSecKeyDestroy(key);    
        fprintf(stderr, "Error: failed to set dsa key params\n");
        return(NULL);
    }   

Aleksey



Meg Morgan wrote:

>Oops forgot to send it to the list too..
>
>  
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [xmlsec] Loading PEM keys from memory instead of a file
> From:
> Meg Morgan <meg@votehere.net>
> Date:
> Fri, 24 Jan 2003 22:02:57 +0000
> To:
> Aleksey Sanin <aleksey@aleksey.com>
>
>
>Hmm, xmlSecDsaKeyGenerate is returning -1 for me.
>The console says:
>
><..\src\dsa.c:533>: error 100: assertion : key != NULL
>
>Here's the input:
>
>xmlSecKeyPtr key = NULL;
>DSA * dsa = NULL;
>char *passwd = "";
>std::string prvkey_str;
>int retval = 0;
>  
>