Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Irina Oleynik
synergy-components
Commits
e8801b74
Commit
e8801b74
authored
Mar 28, 2018
by
Sergey Antonovich
🇯🇵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
f70e850b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
doc/emc/signDocument.md
doc/emc/signDocument.md
+65
-0
No files found.
doc/emc/signDocument.md
0 → 100644
View file @
e8801b74
# Скрипт для подписания ЭЦП
**Поддерживаемая версия Synergy**
: 3.15(wilkes)
**Уровень**
: Разработчик
```
javascript
function
signDocument
(
documentId
,
successHandler
,
errorHandler
){
var
user
;
var
cert
=
null
;
var
endInfo
=
null
;
var
alg
=
null
;
var
certId
=
null
;
var
rawdata
=
null
;
var
signedData
=
null
;
jQuery
.
when
(
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
"
rest/api/person/auth
"
)).
then
(
function
(
person
){
user
=
person
;
return
jQuery
.
get
(
"
https://local.arta.pro:8389/?TYPE=INFO
"
);
}).
then
(
function
(
data
){
cert
=
data
.
CERT
;
endInfo
=
data
.
KEY_CN
;
return
AS
.
FORMS
.
ApiUtils
.
simpleAsyncPost
(
"
rest/sign/verificationkey
"
,
null
,
"
text
"
,
{
uuid
:
user
.
userid
,
pemCer
:
cert
,
edsInfo
:
endInfo
});
}).
then
(
function
(
result
){
if
(
result
==
null
||
result
.
indexOf
(
"
::::
"
)
==
-
1
)
{
if
(
result
==
"
CERT REVOKED
"
)
{
alert
(
"
Сертификат отозван
"
);
}
else
{
alert
(
"
Произошла ошибка проверки ключа
"
);
}
throw
new
Error
();
}
var
args
=
result
.
split
(
"
::::
"
);
alg
=
args
[
1
];
certId
=
args
[
0
];
return
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
"
rest/api/docflow/doc/document_info?documentID=
"
+
documentId
)
}).
then
(
function
(
documentInfo
){
rawdata
=
documentInfo
.
rawdata
;
return
jQuery
.
post
(
"
https://local.arta.pro:8389/
"
,
{
TYPE
:
'
SIGN
'
,
'
DATA
'
:
rawdata
,
'
ALG
'
:
alg
});
}).
then
(
function
(
data
){
signedData
=
data
.
signedData
;
var
sendData
=
{
documentID
:
documentId
,
rawdata
:
rawdata
,
signdata
:
signedData
,
certificate
:
cert
,
certID
:
certId
};
return
AS
.
FORMS
.
ApiUtils
.
simpleAsyncPost
(
"
rest/api/docflow/sign
"
,
null
,
"
text
"
,
sendData
);
}).
then
(
function
(){
if
(
successHandler
)
{
successHandler
();
}
}).
fail
(
function
(
error
){
console
.
log
(
error
);
if
(
errorHandler
)
{
errorHandler
(
error
);
}
});
}
```
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment