加密解密怎么写?我对里面的参数不了解,最好有简单的代码例子。int    RSA_public_encrypt(int flen, const unsigned char *from,
        unsigned char *to, RSA *rsa,int padding);
int    RSA_private_decrypt(int flen, const unsigned char *from, 
        unsigned char *to, RSA *rsa,int padding);int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
    unsigned char *sigret, unsigned int *siglen, RSA *rsa);//参数中type是什么意思?
如何验证证书的有效性,如果生成证书?
对openssl不太了解,这方面的资料也没找到多少....
各位前辈帮帮忙,解决的话我还会加分的o_0!
下面是在C板块发的帖,一样的
http://topic.csdn.net/u/20100322/14/65da0862-eded-4b26-af67-41a9ca97d9fa.html

解决方案 »

  1.   


    你的回复感动得我"痛哭流涕"了,发了两个帖子等了一下午,就你回复了一条-_-!
    谢谢你。如果你C#有解决方案,调用的也是openssl吧? 那也可以告诉我下里面的参数是什么行吗?
    RSA*  rsa_pri_key = RSA_generate_key( 1024 , 3 , NULL , NULL );
    RSA*  rsa_pub_key = RSAPublicKey_dup( rsa_pri_key );
    int pubSize;
    unsigned char text[8] = { 'a','b','c','d','e','f','g' };
    unsigned char outCar[16];
    int encryptNum; //加密解密
    pubSize = RSA_size(rsa_pub_key);
    encryptNum = RSA_public_encrypt(pubSize, text, outCar, rsa_pub_key,RSA_NO_PADDING);
    printf("%d\n",encryptNum);上面是我现在加密的演示代码,结果可以得到128,但是会出错,
    我用C也是新手,现在也不知道哪里出了问题,是调用有问题还是写法有问题。
    不过我对openssl中的加密解密等方法还是不太了解,里面参数也不太清楚。
      

  2.   

    我用的是开源的程序,读取什么PEM文件啥的,没有调用OPENSSL