Initial commit
Initial commit.
This commit is contained in:
16
bootloader/mcuboot/scripts/imgtool/keys/privatebytes.py
Normal file
16
bootloader/mcuboot/scripts/imgtool/keys/privatebytes.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
|
||||
|
||||
class PrivateBytesMixin():
|
||||
def _get_private_bytes(self, minimal, format, exclass):
|
||||
if format is None:
|
||||
format = self._DEFAULT_FORMAT
|
||||
if format not in self._VALID_FORMATS:
|
||||
raise exclass("{} does not support {}".format(
|
||||
self.shortname(), format))
|
||||
return format, self.key.private_bytes(
|
||||
encoding=serialization.Encoding.DER,
|
||||
format=self._VALID_FORMATS[format],
|
||||
encryption_algorithm=serialization.NoEncryption())
|
||||
Reference in New Issue
Block a user