Comments (6)
По примеру кода непонятно, как вы подписываете документ. Для подписания в SDK есть CertificateHelper
from diadocsdk-java.
@atytsky
Здравствуйте.
Попробовал использовать api, документ подписал , но при отправку в веб там все равно ошибка.
Как должны быть наполнен структуры что бы документ после подписания сохранился без ошибок.
RequestedSignatures = null;
RequestedSignatures = new DocumentSignature();
RequestedSignatures.ParentEntityId = CurrentDocument.EntityId;
RequestedSignatures.Signature = Crypt.Sign(CurrentDocument.Content.Data, CurrentCert.RawData);
MsgPatchToPost.AddSignature(RequestedSignatures);
это код для C# он работает.
как выполнить эту же операцию на java ?
from diadocsdk-java.
В C# коде у вас явно есть криптографическая операция:
RequestedSignatures.Signature = Crypt.Sign(CurrentDocument.Content.Data, CurrentCert.RawData)
.
В Java коде вы в подпись передаете контент документа:
requestedSignaturesBuilder.setSignature(ByteString.copyFrom(currentDocument.getContent().toByteArray()))
Ошибка Подписанные данные были искажены после момента подписания
говорит о том, что вы все сделали правильно, но контент подписи не соответствует файлу.
Попробуйте создать подпись с помощью метода Sign
from diadocsdk-java.
@atytsky
не работает.
документ подписан, но ошибка осталась .
В чем может быть еще проблема ?
`
DiadocMessage_PostApiProtos.DocumentSignature.Builder
documentSignatureBuilder;
documentSignatureBuilder
= DiadocMessage_PostApiProtos.DocumentSignature.newBuilder();
DiadocMessage_PostApiProtos.DocumentSignature documentSignature = null;
signedContentBuilder.setContent(ByteString.copyFrom(
currentDocument.getContent().toByteArray()));
signedContent = signedContentBuilder.build();
documentSignatureBuilder.setParentEntityId(currentDocument.getEntityId());
try {
byte[] docSign = CertificateHelper.sign(x509Certificate, signedContent.getContent().toByteArray());
documentSignatureBuilder.setSignature(ByteString.copyFrom(docSign));
} catch (Exception e) {
e.printStackTrace();
}
documentSignature = documentSignatureBuilder.build();
msgPatchToPostBuilder.addSignatures(documentSignature);
msgPatchToPostBuilder.setBoxId(iFromBoxId);
msgPatchToPostBuilder.setMessageId(currentDocument.getMessageId());
msgPatchToPost = msgPatchToPostBuilder.build();`
from diadocsdk-java.
Вопрос не актуален. Решение найдено.
from diadocsdk-java.
Вопрос не актуален. Решение найдено.
А какое решение то подскажите?
from diadocsdk-java.
Related Issues (20)
- Статусы УПД/УКД для маркированных товаров HOT 3
- Есть ли в API Диадок метод для возврата некорректного документа? HOT 2
- Признак завершенного документооборота HOT 1
- Необходимо подписать запрос на аннулирование HOT 24
- Сортировка входящих документов по подразделениям HOT 2
- Вопрос по API Диадока HOT 1
- Получение информации о доверенности, GetPowerOfAttorneyInfo, эксепшен boxId не передан HOT 1
- BoxId в MessagePatchToPost HOT 1
- Требование ИОПа на титул покупателя
- GetRoamingOperators HOT 1
- Заполнение Refusals в TemplatePatchToPost HOT 1
- Ошибка при вызове prevalidatePowerOfAttorney()
- Ошибка при попытке отправить неформализованный документа через PostMessage в Диадок HOT 1
- Использование MTLS HOT 1
- версия в pom и версия jar как-то не линкуются друг с другом
- Подписание и отклонение документа XmlAcceptanceCertificate HOT 4
- Проксирование вызовов через nginx с использованием diadocsdk-java
- GetDocumentById HOT 1
- Swagger
- GetNewEvents версии 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diadocsdk-java.