Skip to content

Conversation

@larabr
Copy link
Collaborator

@larabr larabr commented Aug 16, 2024

As per crypto-refresh, a key is to considered private as long as it includes at least one secret (sub)key packet.

Previously, a PrivateKey could only include secret (sub)key packets.

TODO:

  • this is to be released in v6.2 , as it requires further testing to ensure we didn't miss some edge cases

@larabr larabr requested a review from twiss August 16, 2024 16:02
for (let i = 0; i < keyIndex.length; i++) {
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey) {
const firstPrivateKeyList = packetlist.slice(keyIndex[i], keyIndex[i + 1]);
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey && !firstPrivateKeyList.findPacket(enums.packet.secretSubkey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nitpicky, but since you have it anyway..

Suggested change
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey && !firstPrivateKeyList.findPacket(enums.packet.secretSubkey)) {
if (firstPrivateKeyList[0].constructor.tag === enums.packet.publicKey && !firstPrivateKeyList.findPacket(enums.packet.secretSubkey)) {

for (let i = 0; i < keyIndex.length; i++) {
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey) {
const oneKeyList = packetlist.slice(keyIndex[i], keyIndex[i + 1]);
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey && !oneKeyList.findPacket(enums.packet.secretSubkey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (packetlist[keyIndex[i]].constructor.tag === enums.packet.publicKey && !oneKeyList.findPacket(enums.packet.secretSubkey)) {
if (oneKeyList[0].constructor.tag === enums.packet.publicKey && !oneKeyList.findPacket(enums.packet.secretSubkey)) {

@larabr larabr force-pushed the v6_secret_subkeys_under_public_key branch from 9805782 to 9799ff9 Compare August 20, 2024 15:55
@larabr larabr marked this pull request as draft August 23, 2024 16:18
@larabr larabr force-pushed the v6_secret_subkeys_under_public_key branch from 9799ff9 to 36b5a3f Compare August 23, 2024 16:51
@larabr larabr force-pushed the v6 branch 2 times, most recently from 1baf741 to a3839f6 Compare September 5, 2024 11:26
@larabr larabr added this to the v6.1 milestone Sep 18, 2024
@larabr larabr force-pushed the v6_secret_subkeys_under_public_key branch from 36b5a3f to 366d2c8 Compare September 18, 2024 14:14
@larabr larabr modified the milestones: v6.1, v6.2 Jan 30, 2025
@twiss twiss deleted the branch openpgpjs:main May 19, 2025 13:03
@twiss twiss closed this May 19, 2025
@twiss twiss reopened this May 19, 2025
@twiss twiss changed the base branch from v6 to main May 19, 2025 13:25
@twiss twiss changed the title [v6] Add support for private keys which include public (sub)key packets Add support for private keys which include public (sub)key packets May 19, 2025
@larabr larabr removed this from the v6.2 milestone Jul 31, 2025
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.

2 participants