Debian Codegraph @

docs/superpowers/plans/2026-06-25-pod-documentation-improvements.md

raw symbols SCIP
1 # POD Documentation Improvements Implementation Plan
2
3 > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
5 **Goal:** Fix all identified issues in the POD documentation of `PKCS12.pm` and ship them as a pull request.
6
7 **Architecture:** Primary changes are confined to the `__END__` POD section of `PKCS12.pm`. No XS or Perl logic is touched. The branch is `docs/pod-improvements`.
8
9 **Tech Stack:** Perl POD, `perldoc`, `git`, `gh` CLI.
10
11 ## Global Constraints
12
13 - Primary changes are in `PKCS12.pm` (POD section only — nothing above `__END__`); this plan document is also part of the PR
14 - `$VERSION` on line 7 must remain `1.97` — do not change it
15 - The version string *inside the POD* (currently `1.95`) must be updated to match `1.97`
16 - All existing POD headings must be preserved; add content, do not restructure
17 - Commit messages follow the pattern already in `git log`: short imperative subject line
18 - PR targets `master`
19
20 ---
21
22 ## File Map
23
24 | File | Action |
25 |------|--------|
26 | `PKCS12.pm` | Modify POD section only (lines 22–398) |
27
28 ---
29
30 ### Task 1: Create branch and fix typos + SYNOPSIS
31
32 **Files:**
33 - Modify: `PKCS12.pm` (POD section)
34
35 **Interfaces:**
36 - Produces: clean SYNOPSIS with no syntax errors; zero typos in method entries
37
38 - [ ] **Step 1: Create the working branch**
39
40 ```bash
41 git checkout -b docs/pod-improvements
42 ```
43
44 - [ ] **Step 2: Fix the version string in the POD**
45
46 In `PKCS12.pm`, find line 60:
47 ```
48 This documentation describes version 1.95 of Crypt::OpenSSL::PKCS12
49 ```
50 Change to:
51 ```
52 This documentation describes version 1.97 of Crypt::OpenSSL::PKCS12
53 ```
54
55 - [ ] **Step 3: Fix the three typos in method entries**
56
57 | Location | Wrong | Correct |
58 |----------|-------|---------|
59 | `as_string()` entry | `represenation` | `representation` |
60 | `mac_ok()` entry | `Verifiy` | `Verify` |
61 | SYNOPSIS | `$pksc12_data` | `$pkcs12_data` |
62
63 - [ ] **Step 4: Fix the unclosed `if` block in SYNOPSIS**
64
65 Current SYNOPSIS (partial):
66 ```perl
67 if ($pkcs12->mac_ok($pass)) {
68 ...
69
70 # Creating a file
71 ```
72 Replace with:
73 ```perl
74 if ($pkcs12->mac_ok($pass)) {
75 # MAC verification passed
76 }
77
78 # Creating a file
79 ```
80
81 - [ ] **Step 5: Verify POD parses cleanly**
82
83 ```bash
84 perl -c PKCS12.pm
85 perldoc PKCS12.pm | head -60
86 ```
87 Expected: no errors; SYNOPSIS renders without broken block.
88
89 - [ ] **Step 6: Commit**
90
91 ```bash
92 git add PKCS12.pm
93 git commit -m "docs: fix POD version string, typos, and SYNOPSIS syntax"
94 ```
95
96 ---
97
98 ### Task 2: Document thin/empty method stubs
99
100 **Files:**
101 - Modify: `PKCS12.pm` (POD section, `SUBROUTINES/METHODS` list)
102
103 **Interfaces:**
104 - Consumes: clean POD from Task 1
105 - Produces: `new()`, `new_from_string()`, `new_from_file()`, `legacy_support()` all have meaningful descriptions
106
107 - [ ] **Step 1: Expand `new()`**
108
109 Find:
110 ```pod
111 =item * new( )
112 ```
113 Replace with:
114 ```pod
115 =item * new( )
116
117 Create an empty Crypt::OpenSSL::PKCS12 object. Use C<new_from_string()> or
118 C<new_from_file()> to load an existing PKCS12 structure.
119 ```
120
121 - [ ] **Step 2: Expand `legacy_support()`**
122
123 Find:
124 ```pod
125 =item * legacy_support ( )
126
127 Check whether the openssl version installed supports the legacy provider.
128 ```
129 Replace with:
130 ```pod
131 =item * legacy_support ( )
132
133 Returns true if the installed OpenSSL version supports the legacy provider
134 (required for older cipher suites such as RC2). Always returns false on
135 OpenSSL 1.x, where providers do not exist. On OpenSSL 3.x, returns true
136 only when the legacy provider can be loaded at runtime.
137 ```
138
139 - [ ] **Step 3: Expand `new_from_string()` and `new_from_file()`**
140
141 Find:
142 ```pod
143 =item * new_from_string( C<$string> )
144
145 =item * new_from_file( C<$filename> )
146
147 Create a new Crypt::OpenSSL::PKCS12 instance.
148 ```
149 Replace with:
150 ```pod
151 =item * new_from_string( C<$string> )
152
153 =item * new_from_file( C<$filename> )
154
155 Create a new Crypt::OpenSSL::PKCS12 instance from a binary PKCS12 string or
156 from a file path respectively. Both forms croak on error (invalid format,
157 unreadable file, OpenSSL parse failure).
158 ```
159
160 - [ ] **Step 4: Verify rendering**
161
162 ```bash
163 perldoc PKCS12.pm | grep -A5 "new_from_file"
164 ```
165 Expected: description paragraph appears after the item.
166
167 - [ ] **Step 5: Commit**
168
169 ```bash
170 git add PKCS12.pm
171 git commit -m "docs: expand new(), new_from_string/file(), and legacy_support() POD"
172 ```
173
174 ---
175
176 ### Task 3: Document certificate/key methods and `changepass`
177
178 **Files:**
179 - Modify: `PKCS12.pm` (POD section)
180
181 **Interfaces:**
182 - Consumes: POD from Task 2
183 - Produces: `certificate()`, `ca_certificate()`, `private_key()`, `as_string()`, `mac_ok()`, `changepass()` all document return format, password parameter behaviour, and known caveats
184
185 - [ ] **Step 1: Expand `certificate()` and `ca_certificate()`**
186
187 Find:
188 ```pod
189 =item * certificate( [C<$pass>] )
190
191 Get the Base64 representation of the certificate.
192
193 =item * ca_certificate( [C<$pass>] )
194
195 Get the Base64 representation of the CA certificate chain.
196 ```
197 Replace with:
198 ```pod
199 =item * certificate( [C<$pass>] )
200
201 Returns the end-entity certificate as a PEM-encoded string (Base64 with
202 C<-----BEGIN CERTIFICATE----->/ C<-----END CERTIFICATE-----> headers).
203 C<$pass> is required when the PKCS12 file is password-protected. Croaks on
204 wrong password or missing certificate.
205
206 =item * ca_certificate( [C<$pass>] )
207
208 Returns any CA certificates in the chain as a concatenated PEM string.
209 Returns C<undef> if no CA certificates are present. C<$pass> is required
210 when the PKCS12 file is password-protected.
211 ```
212
213 - [ ] **Step 2: Expand `private_key()`**
214
215 Find:
216 ```pod
217 =item * private_key( [C<$pass>] )
218
219 Get the Base64 representation of the private key.
220 ```
221 Replace with:
222 ```pod
223 =item * private_key( [C<$pass>] )
224
225 Returns the private key as a PEM-encoded string. C<$pass> is required when
226 the PKCS12 file is password-protected. Croaks if no private key is present
227 or if decryption fails.
228 ```
229
230 - [ ] **Step 3: Expand `as_string()`**
231
232 Find:
233 ```pod
234 =item * as_string( [C<$pass>] )
235
236 Get the binary represenation as a string.
237 ```
238 (Note: the typo `represenation` was already fixed in Task 1; this step expands the content.)
239
240 Replace the full item with:
241 ```pod
242 =item * as_string( [C<$pass>] )
243
244 Returns the PKCS12 structure as a raw binary DER string. Useful for writing
245 to a file or transmitting over a network without touching the filesystem.
246 C<$pass> is required when the structure is password-protected.
247 ```
248
249 - [ ] **Step 4: Expand `mac_ok()`**
250
251 Find:
252 ```pod
253 =item * mac_ok( [C<$pass>] )
254
255 Verifiy the certificates Message Authentication Code
256 ```
257 (Note: typo fixed in Task 1.)
258
259 Replace with:
260 ```pod
261 =item * mac_ok( [C<$pass>] )
262
263 Verifies the Message Authentication Code (MAC) of the PKCS12 structure using
264 C<$pass>. Returns true if the MAC is valid, false otherwise. A failed MAC
265 usually indicates a wrong password or a corrupted file.
266 ```
267
268 - [ ] **Step 5: Expand `changepass()`**
269
270 Find:
271 ```pod
272 =item * changepass( C<$old>, C<$new> )
273
274 Change a certificate's password.
275 ```
276 Replace with:
277 ```pod
278 =item * changepass( C<$old>, C<$new> )
279
280 Re-encrypts the PKCS12 structure with a new password. C<$old> is the current
281 password; C<$new> is the replacement. Croaks on failure.
282
283 B<Note:> This method is not supported on OpenSSL 3.x and will croak if
284 called. Use OpenSSL 1.x or migrate to creating a new PKCS12 structure with
285 C<create()>.
286 ```
287
288 - [ ] **Step 6: Verify rendering**
289
290 ```bash
291 perldoc PKCS12.pm | grep -A8 "changepass"
292 ```
293 Expected: note about OpenSSL 3.x appears.
294
295 - [ ] **Step 7: Commit**
296
297 ```bash
298 git add PKCS12.pm
299 git commit -m "docs: document certificate, private_key, mac_ok, changepass methods"
300 ```
301
302 ---
303
304 ### Task 4: Document `create`, `create_as_string`, `info`, `info_as_hash`
305
306 **Files:**
307 - Modify: `PKCS12.pm` (POD section)
308
309 **Interfaces:**
310 - Consumes: POD from Task 3
311 - Produces: all four methods document return values; `info_as_hash()` explains dualvar
312
313 - [ ] **Step 1: Expand `create()`**
314
315 Find:
316 ```pod
317 =item * create( C<$cert>, C<$key>, C<$pass>, C<$output_file>, C<$friendly_name> )
318
319 Create a new PKCS12 certificate. $cert & $key may either be strings or filenames.
320
321 C<$friendly_name> is optional.
322 ```
323 Replace with:
324 ```pod
325 =item * create( C<$cert>, C<$key>, C<$pass>, C<$output_file>, C<$friendly_name> )
326
327 Creates a new PKCS12 file at C<$output_file>. C<$cert> and C<$key> may each be
328 either a PEM string (detected by a C<"-----"> prefix) or a filesystem path.
329 C<$pass> is used to encrypt the private key. C<$friendly_name> is optional and
330 sets the C<friendlyName> bag attribute. Croaks on any OpenSSL error.
331 ```
332
333 - [ ] **Step 2: Expand `create_as_string()`**
334
335 Find:
336 ```pod
337 =item * create_as_string( C<$cert>, C<$key>, C<$pass>, C<$friendly_name> )
338
339 Create a new PKCS12 certificate string. $cert & $key may either be strings or filenames.
340
341 C<$friendly_name> is optional.
342
343 Returns a string holding the PKCS12 certicate.
344 ```
345 Replace with:
346 ```pod
347 =item * create_as_string( C<$cert>, C<$key>, C<$pass>, C<$friendly_name> )
348
349 Same as C<create()> but returns the PKCS12 structure as a raw binary DER string
350 instead of writing to a file. C<$cert> and C<$key> may each be a PEM string or
351 a filesystem path. C<$friendly_name> is optional. Croaks on any OpenSSL error.
352 ```
353
354 - [ ] **Step 3: Add dualvar explanation to `info_as_hash()`**
355
356 Find the paragraph that begins:
357 ```
358 localKeyID "..." (dualvar: 54)
359 ```
360 After the closing `}` of the hash example and before `=back`, add:
361
362 ```pod
363 Attributes such as C<localKeyID> are returned as B<dualvars>: in string
364 context they yield a hex digest (e.g. C<"54">), and in numeric context they
365 yield the integer value (e.g. C<54>). Use C<Scalar::Util::dualvar> if you
366 need to construct one yourself.
367 ```
368
369 - [ ] **Step 4: Verify rendering**
370
371 ```bash
372 perldoc PKCS12.pm | grep -A6 "dualvar"
373 ```
374 Expected: explanation paragraph visible.
375
376 - [ ] **Step 5: Commit**
377
378 ```bash
379 git add PKCS12.pm
380 git commit -m "docs: document create, create_as_string, info_as_hash dualvar"
381 ```
382
383 ---
384
385 ### Task 5: Update EXPORTS, DIAGNOSTICS, DEPENDENCIES, SEE ALSO
386
387 **Files:**
388 - Modify: `PKCS12.pm` (POD section)
389
390 **Interfaces:**
391 - Consumes: POD from Task 4
392 - Produces: all four sections have accurate, non-placeholder content
393
394 - [ ] **Step 1: Document the exported constants**
395
396 Find the EXPORTS section:
397 ```pod
398 On request:
399
400 =over 4
401
402 =item * C<NOKEYS>
403
404 =item * C<NOCERTS>
405
406 =item * C<INFO>
407
408 =item * C<CLCERTS>
409
410 =item * C<CACERTS>
411
412 =back
413 ```
414 Replace with:
415 ```pod
416 On request:
417
418 =over 4
419
420 =item * C<NOKEYS>
421
422 Flag: suppress output of private keys.
423
424 =item * C<NOCERTS>
425
426 Flag: suppress output of certificates.
427
428 =item * C<INFO>
429
430 Flag: print info about the PKCS12 file to C<STDOUT>.
431
432 =item * C<CLCERTS>
433
434 Flag: output only client (end-entity) certificates.
435
436 =item * C<CACERTS>
437
438 Flag: output only CA certificates.
439
440 =back
441
442 These flags mirror the corresponding C<-nokeys>, C<-nocerts>, C<-info>,
443 C<-clcerts>, and C<-cacerts> options of the C<openssl pkcs12> command.
444 ```
445
446 - [ ] **Step 2: Populate DIAGNOSTICS**
447
448 Find:
449 ```pod
450 =head1 DIAGNOSTICS
451
452 No diagnostics are documented at this time
453 ```
454 Replace with:
455 ```pod
456 =head1 DIAGNOSTICS
457
458 =over 4
459
460 =item * B<"OpenSSL error: ..."> — an OpenSSL call failed. The trailing
461 message is taken from C<ERR_reason_error_string()> and identifies the
462 specific failure (e.g. C<"bad decrypt"> for a wrong password).
463
464 =item * B<"Error opening ..."> — C<new_from_file()> could not open the
465 specified file path.
466
467 =item * B<"changepass is not supported on OpenSSL 3"> — C<changepass()>
468 was called on a system running OpenSSL 3.x. Use OpenSSL 1.x or recreate
469 the PKCS12 structure.
470
471 =back
472 ```
473
474 - [ ] **Step 3: Update DEPENDENCIES minimum Perl version**
475
476 Find:
477 ```pod
478 =item * Perl 5.8
479 ```
480 Replace with:
481 ```pod
482 =item * Perl 5.14
483 ```
484
485 - [ ] **Step 4: Update the stale OpenSSL SEE ALSO link**
486
487 Find:
488 ```pod
489 =item * OpenSSL(1) (L<HTTP version with OpenSSL.org|https://www.openssl.org/docs/man1.1.1/man1/openssl.html>)
490 ```
491 Replace with:
492 ```pod
493 =item * OpenSSL(1) (L<HTTP version with OpenSSL.org|https://www.openssl.org/docs/manmaster/man1/openssl.html>)
494 ```
495
496 - [ ] **Step 5: Verify full POD renders without warnings**
497
498 ```bash
499 perl -c PKCS12.pm && perldoc PKCS12.pm | wc -l
500 ```
501 Expected: no errors; line count > 200.
502
503 - [ ] **Step 6: Commit**
504
505 ```bash
506 git add PKCS12.pm
507 git commit -m "docs: update EXPORTS descriptions, DIAGNOSTICS, DEPENDENCIES, SEE ALSO"
508 ```
509
510 ---
511
512 ### Task 6: Open the pull request
513
514 **Files:**
515 - No file changes — uses `gh` CLI only.
516
517 **Interfaces:**
518 - Consumes: branch `docs/pod-improvements` with all four prior task commits
519
520 - [ ] **Step 1: Push the branch**
521
522 ```bash
523 git push -u origin docs/pod-improvements
524 ```
525
526 - [ ] **Step 2: Review the full diff one last time**
527
528 ```bash
529 git diff master..docs/pod-improvements -- PKCS12.pm
530 ```
531 Verify: only POD lines changed; no Perl or XS logic touched.
532
533 - [ ] **Step 3: Open the PR**
534
535 ```bash
536 gh pr create \
537 --title "docs: improve POD documentation in PKCS12.pm" \
538 --body "$(cat <<'EOF'
539 ## Summary
540
541 - Bump version string in POD from 1.95 to 1.97 (matches \`\$VERSION\`)
542 - Fix three typos: \`represenation\`, \`Verifiy\`, \`\$pksc12_data\`
543 - Fix unclosed \`if\` block in SYNOPSIS
544 - Expand empty/thin method stubs: \`new()\`, \`new_from_string/file()\`, \`legacy_support()\`
545 - Document return formats and error behaviour for all certificate/key methods
546 - Add OpenSSL 3.x caveat to \`changepass()\`
547 - Document exported constants (\`NOKEYS\`, \`NOCERTS\`, \`INFO\`, \`CLCERTS\`, \`CACERTS\`)
548 - Populate DIAGNOSTICS with common error messages
549 - Update minimum Perl version in DEPENDENCIES to 5.14
550 - Update stale OpenSSL SEE ALSO link to \`manmaster\`
551 - Explain dualvar behaviour in \`info_as_hash()\` output
552
553 ## Test plan
554
555 - [ ] \`perl -c PKCS12.pm\` passes with no errors
556 - [ ] \`perldoc PKCS12.pm\` renders all sections without mangled formatting
557 - [ ] CI passes (no functional code changed)
558
559 🤖 Generated with [Claude Code](https://claude.com/claude-code)
560 EOF
561 )"
562 ```
563
564 - [ ] **Step 4: Record the PR URL**
565
566 ```bash
567 gh pr view --json url -q .url
568 ```
569
570 ---
571
572 ## Self-Review
573
574 **Spec coverage check:**
575
576 | Issue from audit | Task |
577 |------------------|------|
578 | Version 1.95 → 1.97 | Task 1 |
579 | `represenation` typo | Task 1 |
580 | `Verifiy` typo | Task 1 |
581 | `$pksc12_data` typo | Task 1 |
582 | Unclosed `if` in SYNOPSIS | Task 1 |
583 | `new()` empty | Task 2 |
584 | `legacy_support()` thin | Task 2 |
585 | `new_from_string/file()` thin | Task 2 |
586 | `changepass()` OpenSSL 3.x caveat | Task 3 |
587 | `certificate()` / `ca_certificate()` format | Task 3 |
588 | `private_key()` format | Task 3 |
589 | `as_string()` thin | Task 3 |
590 | `mac_ok()` thin | Task 3 |
591 | `create()` return value | Task 4 |
592 | `create_as_string()` return value | Task 4 |
593 | dualvar unexplained in `info_as_hash()` | Task 4 |
594 | Exported constants undocumented | Task 5 |
595 | DIAGNOSTICS empty | Task 5 |
596 | DEPENDENCIES Perl 5.8 stale | Task 5 |
597 | SEE ALSO OpenSSL link stale | Task 5 |
598 | PR creation | Task 6 |
599
600 All 21 issues are covered. No placeholders used. No cross-task type inconsistencies (pure documentation — no function signatures).