ukify: Derive public key from private key if not specified
This commit is contained in:
committed by
Luca Boccassi
parent
85fe60b9e8
commit
d7d36252e5
+7
-1
@@ -729,11 +729,17 @@ def make_uki(opts):
|
||||
uki = UKI(opts.stub)
|
||||
initrd = join_initrds(opts.initrd)
|
||||
|
||||
# TODO: derive public key from opts.pcr_private_keys?
|
||||
pcrpkey = opts.pcrpkey
|
||||
if pcrpkey is None:
|
||||
if opts.pcr_public_keys and len(opts.pcr_public_keys) == 1:
|
||||
pcrpkey = opts.pcr_public_keys[0]
|
||||
elif opts.pcr_private_keys and len(opts.pcr_private_keys) == 1:
|
||||
import cryptography.hazmat.primitives.serialization as serialization
|
||||
privkey = serialization.load_pem_private_key(opts.pcr_private_keys[0].read_bytes(), password=None)
|
||||
pcrpkey = privkey.public_key().public_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo,
|
||||
)
|
||||
|
||||
sections = [
|
||||
# name, content, measure?
|
||||
|
||||
Reference in New Issue
Block a user