mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-06-09 05:06:52 +00:00
write the functioning p15 file
This commit is contained in:
parent
dd6c6bd442
commit
fc75922d18
2 changed files with 18 additions and 2 deletions
pkg/pkcs15
|
@ -73,6 +73,7 @@ func (p15 *pkcs15KeyCert) encryptedKeyEnvelope() ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
wrappedCEK = append(wrappedCEK, cekPadding...)
|
||||
|
||||
// double encrypt CEK
|
||||
|
@ -102,7 +103,9 @@ func (p15 *pkcs15KeyCert) encryptedKeyEnvelope() ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// envelope content (that will be encrypted)
|
||||
content := p15.privateKeyObject()
|
||||
|
||||
// pad content, see: https://datatracker.ietf.org/doc/html/rfc3852 6.3
|
||||
contentPadLen := uint8(contentDesCipher.BlockSize() - (len(content) % contentDesCipher.BlockSize()))
|
||||
// ALWAYS pad, if content is exact, add full block of padding
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue