| 1 | package SPVM::Mozilla::CA; | ||
| 2 | |||
| 3 | 1 | our $VERSION = "0.003"; | |
| 4 | |||
| 5 | 1 | 1; | |
| 6 | |||
| 7 | =head1 Name | ||
| 8 | |||
| 9 | SPVM::Mozilla::CA - Mozilla's CA cert bundle in PEM format | ||
| 10 | |||
| 11 | =head1 Description | ||
| 12 | |||
| 13 | Mozilla::CA class in L<SPVM> has methods to get Mozilla's CA cert bundle in PEM format. | ||
| 14 | |||
| 15 | =head1 Usage | ||
| 16 | |||
| 17 | use Mozilla::CA; | ||
| 18 | |||
| 19 | my $ssl_ca = Mozilla::CA->SSL_ca; | ||
| 20 | |||
| 21 | =head1 Class Methods | ||
| 22 | |||
| 23 | static method SSL_ca : string (); | ||
| 24 | |||
| 25 | Returns the content of the Mozilla's CA cert bundle PEM file. | ||
| 26 | |||
| 27 | The return value is the same as the content of L<Mozilla::CA#SSL_ca_file|Mozilla::CA/"SSL_ca_file"> method of the version 20240924. | ||
| 28 | |||
| 29 | =head1 Repository | ||
| 30 | |||
| 31 | L<SPVM::Mozilla::CA - Github|https://github.com/yuki-kimoto/SPVM-Mozilla-CA> | ||
| 32 | |||
| 33 | =head1 Porting | ||
| 34 | |||
| 35 | This class is Perl's L<Mozilla::CA> porting to L<SPVM>. | ||
| 36 | |||
| 37 | =head1 FAQ | ||
| 38 | |||
| 39 | =head2 Why is there no SSL_ca_file method? | ||
| 40 | |||
| 41 | SPVM programming language does not have the ability to bundle files. | ||
| 42 | |||
| 43 | If you want to output it to a file, you need to use a temporary file. | ||
| 44 | |||
| 45 | my $ssl_ca = Mozilla::CA->SSL_ca; | ||
| 46 | |||
| 47 | my $tmp_dir = File::Temp->newdir; | ||
| 48 | |||
| 49 | my $ssl_ca_file = "$tmp_dir/cacert.pem"; | ||
| 50 | |||
| 51 | my $fh = IO->open(">", $ssl_ca_file); | ||
| 52 | |||
| 53 | $fh->write($ssl_ca); | ||
| 54 | |||
| 55 | $fh->close; | ||
| 56 | |||
| 57 | See also L<File::Temp|SPVM::File::Temp> and L<IO|SPVM::IO>. | ||
| 58 | |||
| 59 | =head1 Author | ||
| 60 | |||
| 61 | Yuki Kimoto C<kimoto.yuki@gmail.com> | ||
| 62 | |||
| 63 | =head1 Copyright & License | ||
| 64 | |||
| 65 | Copyright (c) 2023 Yuki Kimoto | ||
| 66 | |||
| 67 | MIT License | ||
| 68 |