-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 06574f4
Showing
10 changed files
with
836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
t/ | ||
bin/ | ||
README.pdf | ||
csr.json | ||
logger.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# CryptoPro Mass CSR | ||
|
||
Приложение для создания тестовых электронных подписей КриптоПро на станциях с Windows и Linux. | ||
|
||
### Требования для запуска | ||
|
||
- КриптоПро ЭЦП 4-5 версии | ||
- [КриптоПро ЭЦП Browser plug-in](https://www.cryptopro.ru/products/cades/plugin) | ||
|
||
### Использование | ||
|
||
1. Создайте json файл с описанием csr запросов | ||
|
||
```json | ||
{ | ||
"requests": [ | ||
{ | ||
"providerName": "Crypto-Pro GOST R 34.10-2012 Cryptographic Service Provider", // Необязательный параметр | ||
"container": { | ||
"name": "Test_IvanIvanov", // Необязательный параметр, значение по умолчанию Test_{uuid4} | ||
"exportable": true, // Необязательный параметр, значение по умолчанию false | ||
"keyProtection": 0, // Необязательный параметр, значение по умолчанию 0 | ||
"pin": "1" // Необязательный параметр | ||
}, // Необязательный параметр | ||
"dn": { | ||
"CN": "Иванов Иван", | ||
"2.5.4.4": "Иванов", | ||
"2.5.4.42": "Иван", | ||
"2.5.4.12": "Директор департамента", | ||
"2.5.4.9": "ул. Ивановская 99", | ||
"2.5.4.11": "Отдел маркетинга", | ||
"O": "ОАО \"Серьезные люди\"", | ||
"2.5.4.7": "г. Москва", | ||
"2.5.4.8": "77 г. Москва", | ||
"C": "RU", | ||
"1.2.840.113549.1.9.1": "[email protected]", | ||
"1.2.643.3.131.1.1": "000000000076", | ||
"1.2.643.100.1": "0000000000024", | ||
"1.2.643.100.3": "00000000052" | ||
}, // Обязательный параметр | ||
"extensionEKU": [ | ||
"1.3.6.1.5.5.7.3.2", | ||
"1.3.6.1.5.5.7.3.4" | ||
], // Необязательный параметр, значение по умолчанию "1.3.6.1.5.5.7.3.2" | ||
"ekuKeyUsageFlags": 240 // Необязательный параметр, значение по умолчанию 240 | ||
}, | ||
{ | ||
"container": { | ||
"name": "Test_Petrov", | ||
"exportable": true | ||
}, | ||
"dn": { | ||
"CN": "Петров Пётр", | ||
"2.5.4.4": "Петров", | ||
"2.5.4.42": "Пётр", | ||
"2.5.4.12": "Зам.Директора департамента", | ||
"2.5.4.9": "ул. Ивановская 99", | ||
"2.5.4.11": "Отдел маркетинга", | ||
"O": "ОАО \"Серьезные люди\"", | ||
"2.5.4.7": "г. Москва", | ||
"2.5.4.8": "77 г. Москва", | ||
"C": "RU", | ||
"1.2.840.113549.1.9.1": "[email protected]", | ||
"1.2.643.3.131.1.1": "000000000076", | ||
"1.2.643.100.1": "0000000000024", | ||
"1.2.643.100.3": "00000000052" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
2. Запустите masscsr | ||
|
||
### Аргументы запуска | ||
|
||
```shell | ||
Использование: | ||
masscsr [flags] | ||
|
||
Flags: | ||
-debug | ||
Включить отладочную информацию | ||
-file string | ||
JSON файл с csr запросами (default "csr.json") | ||
-skip-root | ||
Пропустить установку корневого сертификата тестового УЦ | ||
``` | ||
|
||
### Поддержка проекта | ||
|
||
Если вы обнаружили ошибку или хотите предложить идею для улучшения проекта, создайте issue. | ||
|
||
Если у вас есть возможность и желание внести улучшения в проект, отправляйте pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module lazydeus/CryptoMassTest | ||
|
||
go 1.20 | ||
|
||
require golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 | ||
|
||
require ( | ||
github.com/Demetrous-fd/CryptoPro-Adapter v0.0.0-20241009063443-a965bb04c1af // indirect | ||
github.com/google/uuid v1.6.0 // indirect | ||
github.com/otiai10/copy v1.14.0 // indirect | ||
golang.org/x/sync v0.7.0 // indirect | ||
golang.org/x/sys v0.5.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
github.com/Demetrous-fd/CryptoPro-Adapter v0.0.0-20241009063443-a965bb04c1af h1:gl4IIMPGJWovLcgfDY9Q5pNbLX3T3qgUpd4yaVZwzXo= | ||
github.com/Demetrous-fd/CryptoPro-Adapter v0.0.0-20241009063443-a965bb04c1af/go.mod h1:u3GJFQjJZ7lfZv/guG3cnAISW6Ua9B7dOhBYCErEXXA= | ||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= | ||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= | ||
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= | ||
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= | ||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= | ||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= | ||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= | ||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= | ||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= | ||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python | ||
|
||
from pathlib import Path | ||
import zipfile | ||
import sys | ||
import os | ||
|
||
|
||
files = " ".join([str(file) for file in Path("src").glob("*.go")]) | ||
windows_folder = "bin/windows" | ||
linux_folder = "bin/linux" | ||
commands = { | ||
"run": f"go run {files}" | ||
} | ||
|
||
|
||
build_commands = { | ||
"amd64": [ | ||
f"windows;go build -trimpath -ldflags \"-s -w\" -o {windows_folder}/masscsr.exe {files}", | ||
f"linux;go build -trimpath -ldflags \"-s -w\" -o {linux_folder}/masscsr {files}", | ||
], | ||
"386": [ | ||
f"windows;go build -trimpath -ldflags \"-s -w\" -o {windows_folder}/masscsr_32.exe {files}", | ||
f"linux;go build -trimpath -ldflags \"-s -w\" -o {linux_folder}/masscsr_32 {files}", | ||
], | ||
} | ||
|
||
|
||
def create_zip(zip_filename, folder_to_zip): | ||
zip_filepath = Path(zip_filename) | ||
folder_path = Path(folder_to_zip) | ||
|
||
with zipfile.ZipFile(zip_filepath, 'w') as zip_file: | ||
for file in folder_path.rglob('*'): | ||
if file.is_file() and file.name != zip_filepath.name: | ||
zip_file.write(file, file.relative_to(folder_path)) | ||
|
||
|
||
if len(sys.argv) >= 2: | ||
arg = sys.argv[1] | ||
if arg != "build": | ||
exit(1) | ||
|
||
for arch in build_commands.keys(): | ||
os.environ["GOARCH"] = arch | ||
for command in build_commands[arch]: | ||
os_name, command = command.split(";", 1) | ||
os.environ["GOOS"] = os_name | ||
os.system(command) | ||
create_zip(f"{windows_folder}/masscsr_windows.zip", windows_folder) | ||
create_zip(f"{linux_folder}/masscsr_linux.zip", linux_folder) | ||
else: | ||
os.system(commands["run"]) | ||
|
Oops, something went wrong.