8000 High-Level API #0: Preparations for high-level OpenPGP Key Generator API by vanitasvitae · Pull Request #1926 · bcgit/bc-java · GitHub
[go: up one dir, main page]

Skip to content

High-Level API #0: Preparations for high-level OpenPGP Key Generator API #1926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PGPKeyRingGenerator: Various improvements
* Rename masterKey -> primaryKey
* Add generics to list structures
* sanitize primary and subkeys
* properly instantiate signature generators by passing key version
  • Loading branch information
vanitasvitae committed Dec 17, 2024
commit af7734772daf8cbd1c027a41fdcd0a4ecfb1bd7f
< 10000 div class="js-diff-progressive-container">
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public PGPKeyRingGenerator(
this.keySignerBuilder = keySignerBuilder;

PGPSignature certSig = (PGPSignature)originalSecretRing.getPublicKey().getSignatures().next();
List hashedVec = new ArrayList();
List<SignatureSubpacket> hashedVec = new ArrayList<SignatureSubpacket>();
PGPSignatureSubpacketVector existing = certSig.getHashedSubPackets();
for (int i = 0; i != existing.size(); i++)
{
Expand All @@ -164,7 +164,7 @@ public PGPKeyRingGenerator(
hashedVec.add(existing.packets[i]);
}
this.hashedPcks = new PGPSignatureSubpacketVector(
(SignatureSubpacket[])hashedVec.toArray(new SignatureSubpacket[hashedVec.size()]));
hashedVec.toArray(new SignatureSubpacket[0]));
this.unhashedPcks = certSig.getUnhashedSubPackets();

keys.addAll(originalSecretRing.keys);
Expand Down Expand Up @@ -323,9 +323,7 @@ public void addSubKey(
}

sGen.setUnhashedSubpackets(unhashedPcks);

List subSigs = new ArrayList();

List<PGPSignature> subSigs = new ArrayList<PGPSignature>();
subSigs.add(sGen.generateCertification(primaryKey.getPublicKey(), keyPair.getPublicKey()));

// replace the public key packet structure with a public subkey one.
Expand Down Expand Up @@ -362,14 +360,14 @@ public PGPSecretKeyRing generateSecretKeyRing()
*/
public PGPPublicKeyRing generatePublicKeyRing()
{
Iterator it = keys.iterator();
List pubKeys = new ArrayList();
Iterator<PGPSecretKey> it = keys.iterator();
List<PGPPublicKey> pubKeys = new ArrayList<PGPPublicKey>();

pubKeys.add(((PGPSecretKey)it.next()).getPublicKey());
pubKeys.add((it.next()).getPublicKey());

while (it.hasNext())
{
pubKeys.add(((PGPSecretKey)it.next()).getPublicKey());
pubKeys.add((it.next()).getPublicKey());
}

return new PGPPublicKeyRing(pubKeys);
Expand Down
0