mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-07-05 23:56:34 +00:00
add p15 key output file
The NMC Security Wizard can also produce .p15 files that contain just a private key. Add this ability to this tool. When the `create` function is used, both files will be outputted.
This commit is contained in:
parent
ecf10f1fdc
commit
01be6ca577
6 changed files with 206 additions and 87 deletions
pkg/app
|
@ -7,6 +7,8 @@ import (
|
|||
"github.com/sigurn/crc16"
|
||||
)
|
||||
|
||||
const apcHeaderLen = 228
|
||||
|
||||
// makeFileHeader generates the 228 byte header to prepend to the .p15
|
||||
// as required by APC UPS NMC. Contrary to the apc_tools repo, it does
|
||||
// mot appear the header changes based on key size.
|
||||
|
@ -28,7 +30,7 @@ func makeFileHeader(p15File []byte) ([]byte, error) {
|
|||
// *(uint32_t *)(buf + 208) = keySize; // 1 for 1024 key, otherwise (2048 bit) 2
|
||||
// Unsure why this was in original code but seems irrelevant
|
||||
|
||||
header := make([]byte, 228)
|
||||
header := make([]byte, apcHeaderLen)
|
||||
|
||||
// always 1
|
||||
header[0] = 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue