*** printCert.cpp 2008-07-27 21:04:59.000000000 +0900 --- printCert.cpp.org 2008-07-27 20:58:12.000000000 +0900 *************** *** 58,65 **** #include "oidParser.h" #include "timeStr.h" #include - #include - #include static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", --- 58,63 ---- *************** *** 789,816 **** printf("Pub key Bytes : Length %d bytes : ", (int)pubKeyInfo->subjectPublicKey.Length); printDataAsHex(&pubKeyInfo->subjectPublicKey, 8); - - // http://x68000.q-e-d.net/~68user/net/rsa-1.html - #define BN_PUT(bn) { printf(#bn "=%s (0x%s)\n", BN_bn2dec(bn), BN_bn2hex(bn)); } - - EVP_PKEY *pkey = NULL; - RSA *rsa = NULL; - unsigned char *p; - long j; - int type; - type=EVP_PKEY_RSA; - p=pubKeyInfo->subjectPublicKey.Data; - j=pubKeyInfo->subjectPublicKey.Length; - if ((pkey=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL) { - } - rsa = EVP_PKEY_get1_RSA(pkey); - BN_PUT(rsa->n); - BN_PUT(rsa->e); - unsigned char crypted_buf[1024]; - unsigned char plain_buf[]="hogehoge"; - int crypted_len = RSA_public_encrypt(strlen((char *)plain_buf), plain_buf, crypted_buf, rsa, RSA_PKCS1_PADDING); - - printf("RSA_public_encrypt len =%d\n", crypted_len); } } else if(appCompareCssmData(thisOid, &CSSMOID_CSSMKeyStruct)) { --- 787,792 ----