Diff

Differences From Artifact [7200c62d18]:

To Artifact [7438606333]:


65
66
67
68
69
70
71


72
73
74
75
76
77
78
		case 0x00000180: return "CKA_EC_PARAMS";
		case 0x00000181: return "CKA_EC_POINT";
		case 0x00000200: return "CKA_SECONDARY_AUTH";
		case 0x00000201: return "CKA_AUTH_PIN_FLAGS";
		case 0x00000300: return "CKA_HW_FEATURE_TYPE";
		case 0x00000301: return "CKA_RESET_ON_INIT";
		case 0x00000302: return "CKA_HAS_RESET";


	}

	snprintf(retbuf, sizeof(retbuf), "0x%08lx", (unsigned long) attrib);
	retbuf[sizeof(retbuf) - 1] = '\0';

	return(retbuf);
}







>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
		case 0x00000180: return "CKA_EC_PARAMS";
		case 0x00000181: return "CKA_EC_POINT";
		case 0x00000200: return "CKA_SECONDARY_AUTH";
		case 0x00000201: return "CKA_AUTH_PIN_FLAGS";
		case 0x00000300: return "CKA_HW_FEATURE_TYPE";
		case 0x00000301: return "CKA_RESET_ON_INIT";
		case 0x00000302: return "CKA_HAS_RESET";
		case 0xce5363b4: return "CKA_CERT_SHA1_HASH";
		case 0xce5363b5: return "CKA_CERT_MD5_HASH";
	}

	snprintf(retbuf, sizeof(retbuf), "0x%08lx", (unsigned long) attrib);
	retbuf[sizeof(retbuf) - 1] = '\0';

	return(retbuf);
}
114
115
116
117
118
119
120
121
122
123
124
125














126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
	                           {CKA_TOKEN, NULL, 0},
	                           {CKA_LABEL, NULL, 0},
	                           {CKA_PRIVATE, NULL, 0},
	                           {CKA_ID, NULL, 0},
	                           {CKA_SERIAL_NUMBER, NULL, 0},
	                           {CKA_SUBJECT, NULL, 0},
	                           {CKA_ISSUER, NULL, 0},
	                           {CKA_PRIVATE, NULL, 0},
	                           {CKA_CERTIFICATE_TYPE, NULL, 0},
	                           {CKA_KEY_TYPE, NULL, 0},
	                           {CKA_SIGN, NULL, 0},
	                           {CKA_VALUE, NULL, 0}














	                          }, *curr_attr;
	CK_ULONG curr_attr_idx;
	CK_ULONG byte_idx;
	CK_UTF8CHAR user_pin[1024], *pucValue;
	CK_OBJECT_CLASS objectClass;
	CK_BYTE signature[1024], encrypted_buf[16384], decrypted_buf[16384];
	CK_ULONG signature_len, encrypted_buflen, decrypted_buflen;
	CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0};
	CK_RV chk_rv;
	char *fgets_ret;
	int i;

	chk_rv = C_GetFunctionList(&pFunctionList);
	if (chk_rv != CKR_OK) {
		printf("C_GetFunctionList() failed.");

		return(1);
	}


	C_CloseSession = pFunctionList->C_CloseSession;
	C_Decrypt = pFunctionList->C_Decrypt;
	C_DecryptInit = pFunctionList->C_DecryptInit;
	C_Encrypt = pFunctionList->C_Encrypt;
	C_EncryptInit = pFunctionList->C_EncryptInit;
	C_Finalize = pFunctionList->C_Finalize;







<



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















<







116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
	                           {CKA_TOKEN, NULL, 0},
	                           {CKA_LABEL, NULL, 0},
	                           {CKA_PRIVATE, NULL, 0},
	                           {CKA_ID, NULL, 0},
	                           {CKA_SERIAL_NUMBER, NULL, 0},
	                           {CKA_SUBJECT, NULL, 0},
	                           {CKA_ISSUER, NULL, 0},

	                           {CKA_CERTIFICATE_TYPE, NULL, 0},
	                           {CKA_KEY_TYPE, NULL, 0},
	                           {CKA_SIGN, NULL, 0},
	                           {CKA_VALUE, NULL, 0},
				   {CKA_CERT_MD5_HASH, NULL, 0},
				   {CKA_CERT_SHA1_HASH, NULL, 0},
				   {CKA_TRUSTED, NULL, 0},
				   {CKA_TRUST_CLIENT_AUTH, NULL, 0},
				   {CKA_TRUST_CODE_SIGNING, NULL, 0},
				   {CKA_TRUST_CRL_SIGN, NULL, 0},
				   {CKA_TRUST_DATA_ENCIPHERMENT, NULL, 0},
				   {CKA_TRUST_DIGITAL_SIGNATURE, NULL, 0},
				   {CKA_TRUST_EMAIL_PROTECTION, NULL, 0},
				   {CKA_TRUST_KEY_AGREEMENT, NULL, 0},
				   {CKA_TRUST_KEY_CERT_SIGN, NULL, 0},
				   {CKA_TRUST_KEY_ENCIPHERMENT, NULL, 0},
				   {CKA_TRUST_NON_REPUDIATION, NULL, 0},
				   {CKA_TRUST_SERVER_AUTH, NULL, 0}
	                          }, *curr_attr;
	CK_ULONG curr_attr_idx;
	CK_ULONG byte_idx;
	CK_UTF8CHAR user_pin[1024], *pucValue;
	CK_OBJECT_CLASS objectClass;
	CK_BYTE signature[1024], encrypted_buf[16384], decrypted_buf[16384];
	CK_ULONG signature_len, encrypted_buflen, decrypted_buflen;
	CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0};
	CK_RV chk_rv;
	char *fgets_ret;
	int i;

	chk_rv = C_GetFunctionList(&pFunctionList);
	if (chk_rv != CKR_OK) {
		printf("C_GetFunctionList() failed.");

		return(1);
	}


	C_CloseSession = pFunctionList->C_CloseSession;
	C_Decrypt = pFunctionList->C_Decrypt;
	C_DecryptInit = pFunctionList->C_DecryptInit;
	C_Encrypt = pFunctionList->C_Encrypt;
	C_EncryptInit = pFunctionList->C_EncryptInit;
	C_Finalize = pFunctionList->C_Finalize;
438
439
440
441
442
443
444




445
446
447
448
449
450
451
									case CKA_ID:
									case CKA_SERIAL_NUMBER:
									case CKA_PRIVATE:
									case CKA_CERTIFICATE_TYPE:
									case CKA_KEY_TYPE:
									case CKA_SIGN:
									case CKA_DECRYPT:




										pucValue = curr_attr->pValue;

										printf("    [%lu] %20s: ", hObject, pkcs11_attribute_to_name(curr_attr->type));

										for (byte_idx = 0; byte_idx < curr_attr->ulValueLen; byte_idx++) {
											printf("%02x ", (unsigned int) pucValue[byte_idx]);
										}







>
>
>
>







452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
									case CKA_ID:
									case CKA_SERIAL_NUMBER:
									case CKA_PRIVATE:
									case CKA_CERTIFICATE_TYPE:
									case CKA_KEY_TYPE:
									case CKA_SIGN:
									case CKA_DECRYPT:
									case CKA_TRUSTED:
									case CKA_CERT_MD5_HASH:
									case CKA_CERT_SHA1_HASH:

										pucValue = curr_attr->pValue;

										printf("    [%lu] %20s: ", hObject, pkcs11_attribute_to_name(curr_attr->type));

										for (byte_idx = 0; byte_idx < curr_attr->ulValueLen; byte_idx++) {
											printf("%02x ", (unsigned int) pucValue[byte_idx]);
										}
461
462
463
464
465
466
467












468
469
470
471
472
473
474

										for (byte_idx = 0; byte_idx < curr_attr->ulValueLen; byte_idx++) {
											printf("\\x%02x", (unsigned int) pucValue[byte_idx]);
										}

										printf(" ;; %p/%lu\n", curr_attr->pValue, curr_attr->ulValueLen);













										break;
									default:
										printf("    [%lu] %20s: %p/%lu\n", hObject, pkcs11_attribute_to_name(curr_attr->type), curr_attr->pValue, curr_attr->ulValueLen);

										break;
								}
							} else {







>
>
>
>
>
>
>
>
>
>
>
>







479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504

										for (byte_idx = 0; byte_idx < curr_attr->ulValueLen; byte_idx++) {
											printf("\\x%02x", (unsigned int) pucValue[byte_idx]);
										}

										printf(" ;; %p/%lu\n", curr_attr->pValue, curr_attr->ulValueLen);

										break;
									case CKA_TRUST_CLIENT_AUTH:
									case CKA_TRUST_CODE_SIGNING:
									case CKA_TRUST_CRL_SIGN:
									case CKA_TRUST_DATA_ENCIPHERMENT:
									case CKA_TRUST_DIGITAL_SIGNATURE:
									case CKA_TRUST_EMAIL_PROTECTION:
									case CKA_TRUST_KEY_AGREEMENT:
									case CKA_TRUST_KEY_CERT_SIGN:
									case CKA_TRUST_KEY_ENCIPHERMENT:
									case CKA_TRUST_NON_REPUDIATION:
									case CKA_TRUST_SERVER_AUTH:
										break;
									default:
										printf("    [%lu] %20s: %p/%lu\n", hObject, pkcs11_attribute_to_name(curr_attr->type), curr_attr->pValue, curr_attr->ulValueLen);

										break;
								}
							} else {