Skip to content

Fixed key pair generation issue#50

Open
cowbon wants to merge 1 commit intointel:mainfrom
cowbon:crypto-fix
Open

Fixed key pair generation issue#50
cowbon wants to merge 1 commit intointel:mainfrom
cowbon:crypto-fix

Conversation

@cowbon
Copy link
Copy Markdown

@cowbon cowbon commented Mar 25, 2026

tdx.GenerateKeyPair hard-codes the PEM block type as "PRIVATE KEY" while serializing the bytes with x509.MarshalPKCS1PrivateKey, the output is indeed PKCS#1 data wrapped in a PKCS#8-style label. This causes the error to load the private key generated by trustauthority-cli. PKCS#1 should use Type: "RSA PRIVATE KEY" wheras PKCS#8 should use Type: "PRIVATE KEY". Align the header with the payload without changing the logic.

tdx.GenerateKeyPair hard-codes the PEM block type as "PRIVATE KEY"
while serializing the bytes with x509.MarshalPKCS1PrivateKey, the output
is indeed PKCS#1 data wrapped in a PKCS#8-style label. This causes the
error to load the private key generated by trustauthority-cli. PKCS#1
should use Type: "RSA PRIVATE KEY" wheras PKCS#8 should use Type:
"PRIVATE KEY". Align the header with the payload without changing the
logic.

Signed-off-by: Ian Chin Wang <ian.chin.wang@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant