| ||||
| ||||
Я никак не могу добавить атрибуты в объект Signer: 1) Создаю три объекта Attribute и устанавливаю их значение: DispatchPtr dataType = new DispatchPtr("CAPICOM.Attribute.1"); DispatchPtr docId = new DispatchPtr("CAPICOM.Attribute.1"); DispatchPtr dtCreate = new DispatchPtr("CAPICOM.Attribute.1"); dataType.put("Name",CAPICOM_ATTRIBUTE.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME); dataType.put("Value","DOC"); docId.put("Name",CAPICOM_ATTRIBUTE.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION); docId.put("Value",_docGuid); dtCreate.put("Name",CAPICOM_ATTRIBUTE.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME); dtCreate.put("Value",calendar.getTime()); 2) Получаю объект Signer DispatchPtr signer = new DispatchPtr("CAPICOM.Signer.2"); Затем пытаюсь установить ему атрибуты посредством метода AuthenticatedAttributes, не получается. Тот ли метод я использую. И если есть возможность покажите пример. | ||||
Ответы: | ||||
| ||||
Вот пример на VB из MSDN ' Detect Signer object creation errors. On Error GoTo Err_Object_Signer Dim Signer As New Signer ' Detect SigningTime object creation errors. On Error GoTo Err_Object_SigningTime ' NOTE: The name 'Attribute' is not a unique name ' and must be preceded by 'CAPICOM.' Dim SigningTime As New CAPICOM.Attribute ' Stop detecting errors. On Error GoTo 0 ' Save the time the data was signed as a signer attribute. SigningTime.Name = CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME SigningTime.Value = Now Signer.AuthenticatedAttributes.Add SigningTime ' A signer's certificate would be added to the Signer object, and ' the Signer object would be used as the first parameter to a ' SignData object sign method. Exit Sub Err_Object_Signer: MsgBox ("An error occurred while creating the Signer object.") Exit Sub Err_Object_SigningTime: MsgBox ("An error occurred while creating the SigningTime _ object.") | ||||