rbs 2.8.4 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -4
- data/.github/workflows/comments.yml +11 -11
- data/.github/workflows/dependabot.yml +30 -0
- data/.github/workflows/ruby.yml +40 -49
- data/.github/workflows/typecheck.yml +36 -0
- data/.github/workflows/windows.yml +28 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +42 -2
- data/CHANGELOG.md +845 -1
- data/README.md +64 -4
- data/Rakefile +198 -18
- data/Steepfile +11 -11
- data/config.yml +311 -0
- data/core/array.rbs +2189 -1914
- data/core/basic_object.rbs +59 -84
- data/core/binding.rbs +7 -69
- data/core/builtin.rbs +210 -11
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +23 -25
- data/core/complex.rbs +449 -227
- data/core/constants.rbs +29 -21
- data/core/data.rbs +415 -0
- data/core/dir.rbs +698 -415
- data/core/encoding.rbs +468 -843
- data/core/enumerable.rbs +495 -455
- data/core/enumerator/product.rbs +92 -0
- data/core/enumerator.rbs +106 -9
- data/core/env.rbs +1 -1
- data/core/errno.rbs +506 -605
- data/core/errors.rbs +15 -17
- data/core/exception.rbs +361 -145
- data/core/false_class.rbs +39 -26
- data/core/fiber.rbs +121 -14
- data/core/file.rbs +1262 -320
- data/core/file_test.rbs +62 -45
- data/core/float.rbs +187 -208
- data/core/gc.rbs +446 -196
- data/core/global_variables.rbs +29 -29
- data/core/hash.rbs +242 -349
- data/core/integer.rbs +246 -308
- data/core/io/buffer.rbs +373 -122
- data/core/io/wait.rbs +29 -17
- data/core/io.rbs +1881 -1518
- data/core/kernel.rbs +2116 -1538
- data/core/marshal.rbs +24 -14
- data/core/match_data.rbs +413 -166
- data/core/math.rbs +531 -291
- data/core/method.rbs +101 -32
- data/core/module.rbs +228 -64
- data/core/nil_class.rbs +106 -47
- data/core/numeric.rbs +206 -292
- data/core/object.rbs +73 -1168
- data/core/object_space/weak_key_map.rbs +166 -0
- data/core/object_space.rbs +5 -3
- data/core/proc.rbs +280 -39
- data/core/process.rbs +1318 -658
- data/core/ractor.rbs +200 -134
- data/core/random.rbs +21 -4
- data/core/range.rbs +309 -153
- data/core/rational.rbs +4 -12
- data/core/rb_config.rbs +64 -43
- data/core/rbs/unnamed/argf.rbs +411 -147
- data/core/rbs/unnamed/env_class.rbs +137 -253
- data/core/rbs/unnamed/random.rbs +49 -26
- data/core/refinement.rbs +16 -1
- data/core/regexp.rbs +1568 -862
- data/core/ruby_vm.rbs +719 -7
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +69 -6
- data/core/rubygems/rubygems.rbs +71 -17
- data/core/rubygems/version.rbs +11 -7
- data/{stdlib/set/0 → core}/set.rbs +80 -91
- data/core/signal.rbs +14 -8
- data/core/string.rbs +1732 -1607
- data/core/struct.rbs +467 -95
- data/core/symbol.rbs +215 -245
- data/core/thread.rbs +133 -89
- data/core/thread_group.rbs +9 -9
- data/core/time.rbs +1141 -841
- data/core/trace_point.rbs +181 -121
- data/core/true_class.rbs +58 -32
- data/core/unbound_method.rbs +103 -30
- data/core/warning.rbs +50 -5
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/architecture.md +110 -0
- data/docs/collection.md +59 -5
- data/docs/data_and_struct.md +86 -0
- data/docs/gem.md +57 -0
- data/docs/rbs_by_example.md +16 -35
- data/docs/repo.md +1 -1
- data/docs/sigs.md +7 -7
- data/docs/stdlib.md +63 -5
- data/docs/syntax.md +255 -61
- data/docs/tools.md +1 -0
- data/ext/rbs_extension/extconf.rb +10 -0
- data/ext/rbs_extension/lexer.c +1741 -1548
- data/ext/rbs_extension/lexer.h +11 -1
- data/ext/rbs_extension/lexer.re +12 -6
- data/ext/rbs_extension/lexstate.c +26 -3
- data/ext/rbs_extension/location.c +119 -111
- data/ext/rbs_extension/location.h +32 -7
- data/ext/rbs_extension/main.c +3 -0
- data/ext/rbs_extension/parser.c +883 -481
- data/ext/rbs_extension/parserstate.c +65 -25
- data/ext/rbs_extension/parserstate.h +13 -3
- data/ext/rbs_extension/rbs_extension.h +1 -10
- data/ext/rbs_extension/unescape.c +7 -47
- data/goodcheck.yml +2 -2
- data/{ext/rbs_extension → include/rbs}/constants.h +26 -15
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/formatter.rb +13 -3
- data/lib/rbs/annotate/rdoc_annotator.rb +1 -1
- data/lib/rbs/annotate/rdoc_source.rb +12 -3
- data/lib/rbs/ast/declarations.rb +85 -2
- data/lib/rbs/ast/directives.rb +39 -0
- data/lib/rbs/ast/members.rb +49 -15
- data/lib/rbs/ast/type_param.rb +104 -15
- data/lib/rbs/ast/visitor.rb +137 -0
- data/lib/rbs/buffer.rb +5 -0
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +83 -0
- data/lib/rbs/cli/validate.rb +356 -0
- data/lib/rbs/cli.rb +253 -143
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +92 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +154 -65
- data/lib/rbs/collection/config.rb +19 -46
- data/lib/rbs/collection/installer.rb +12 -13
- data/lib/rbs/collection/sources/base.rb +2 -2
- data/lib/rbs/collection/sources/git.rb +146 -69
- data/lib/rbs/collection/sources/local.rb +81 -0
- data/lib/rbs/collection/sources/rubygems.rb +10 -12
- data/lib/rbs/collection/sources/stdlib.rb +14 -13
- data/lib/rbs/collection/sources.rb +15 -2
- data/lib/rbs/collection.rb +2 -1
- data/lib/rbs/definition.rb +13 -16
- data/lib/rbs/definition_builder/ancestor_builder.rb +100 -24
- data/lib/rbs/definition_builder/method_builder.rb +4 -4
- data/lib/rbs/definition_builder.rb +489 -584
- data/lib/rbs/diff.rb +125 -0
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +406 -105
- data/lib/rbs/environment_loader.rb +48 -44
- data/lib/rbs/environment_walker.rb +1 -1
- data/lib/rbs/errors.rb +175 -56
- data/lib/rbs/file_finder.rb +28 -0
- data/lib/rbs/location_aux.rb +8 -7
- data/lib/rbs/locator.rb +37 -15
- data/lib/rbs/method_type.rb +23 -0
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser/lex_result.rb +15 -0
- data/lib/rbs/parser/token.rb +23 -0
- data/lib/rbs/parser_aux.rb +22 -13
- data/lib/rbs/prototype/helpers.rb +48 -22
- data/lib/rbs/prototype/node_usage.rb +99 -0
- data/lib/rbs/prototype/rb.rb +125 -31
- data/lib/rbs/prototype/rbi.rb +49 -36
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/reflection.rb +19 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
- data/lib/rbs/prototype/runtime.rb +273 -159
- data/lib/rbs/resolver/constant_resolver.rb +24 -8
- data/lib/rbs/resolver/type_name_resolver.rb +41 -7
- data/lib/rbs/sorter.rb +153 -123
- data/lib/rbs/substitution.rb +19 -0
- data/lib/rbs/subtractor.rb +201 -0
- data/lib/rbs/test/errors.rb +24 -11
- data/lib/rbs/test/guaranteed.rb +30 -0
- data/lib/rbs/test/hook.rb +45 -40
- data/lib/rbs/test/setup.rb +1 -1
- data/lib/rbs/test/tester.rb +1 -1
- data/lib/rbs/test/type_check.rb +120 -23
- data/lib/rbs/test.rb +6 -3
- data/lib/rbs/type_alias_dependency.rb +13 -3
- data/lib/rbs/type_alias_regularity.rb +21 -14
- data/lib/rbs/type_name.rb +18 -13
- data/lib/rbs/types.rb +352 -18
- data/lib/rbs/unit_test/convertibles.rb +176 -0
- data/lib/rbs/unit_test/spy.rb +136 -0
- data/lib/rbs/unit_test/type_assertions.rb +341 -0
- data/lib/rbs/unit_test/with_aliases.rb +143 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/validator.rb +55 -30
- data/lib/rbs/variance_calculator.rb +26 -23
- data/lib/rbs/vendorer.rb +3 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +69 -22
- data/lib/rbs.rb +7 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +5 -5
- data/rbs.gemspec +12 -2
- data/schema/decls.json +1 -1
- data/schema/members.json +15 -10
- data/sig/ancestor_builder.rbs +4 -0
- data/sig/ancestor_graph.rbs +22 -2
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +21 -0
- data/sig/cli/validate.rbs +43 -0
- data/sig/cli.rbs +4 -0
- data/sig/collection/config/lockfile.rbs +74 -0
- data/sig/collection/config/lockfile_generator.rbs +66 -0
- data/sig/collection/config.rbs +5 -48
- data/sig/collection/installer.rbs +1 -1
- data/sig/collection/sources.rbs +105 -33
- data/sig/constant.rbs +1 -1
- data/sig/declarations.rbs +42 -3
- data/sig/definition.rbs +26 -10
- data/sig/definition_builder.rbs +103 -81
- data/sig/diff.rbs +28 -0
- data/sig/directives.rbs +61 -0
- data/sig/environment.rbs +175 -29
- data/sig/environment_loader.rbs +20 -18
- data/sig/errors.rbs +123 -2
- data/sig/file_finder.rbs +28 -0
- data/sig/location.rbs +0 -3
- data/sig/locator.rbs +14 -2
- data/sig/manifest.yaml +0 -1
- data/sig/members.rbs +32 -9
- data/sig/method_types.rbs +10 -4
- data/sig/namespace.rbs +2 -3
- data/sig/parser.rbs +55 -16
- data/sig/prototype/helpers.rbs +4 -0
- data/sig/prototype/node_usage.rbs +20 -0
- data/sig/prototype/rb.rbs +10 -2
- data/sig/prototype/rbi.rbs +2 -0
- data/sig/prototype/runtime.rbs +182 -0
- data/sig/rbs.rbs +1 -1
- data/sig/rdoc/rbs.rbs +4 -0
- data/sig/repository.rbs +7 -5
- data/sig/resolver/constant_resolver.rbs +3 -4
- data/sig/resolver/context.rbs +1 -1
- data/sig/resolver/type_name_resolver.rbs +5 -1
- data/sig/shims/bundler.rbs +38 -0
- data/sig/shims/rubygems.rbs +19 -0
- data/sig/sorter.rbs +23 -5
- data/sig/substitution.rbs +6 -0
- data/sig/subtractor.rbs +37 -0
- data/sig/test/errors.rbs +52 -0
- data/sig/test/guranteed.rbs +9 -0
- data/sig/test/type_check.rbs +19 -0
- data/sig/test.rbs +82 -0
- data/sig/type_alias_dependency.rbs +31 -0
- data/sig/type_alias_regularity.rbs +12 -6
- data/sig/type_param.rbs +45 -9
- data/sig/typename.rbs +8 -5
- data/sig/types.rbs +119 -12
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +28 -0
- data/sig/unit_test/type_assertions.rbs +194 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/sig/use_map.rbs +35 -0
- data/sig/validator.rbs +12 -5
- data/sig/variance_calculator.rbs +3 -1
- data/sig/vendorer.rbs +1 -1
- data/sig/visitor.rbs +47 -0
- data/sig/writer.rbs +6 -2
- data/src/constants.c +153 -0
- data/src/ruby_objs.c +793 -0
- data/stdlib/base64/0/base64.rbs +298 -45
- data/stdlib/benchmark/0/benchmark.rbs +12 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +62 -198
- data/stdlib/cgi/0/core.rbs +68 -15
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/coverage/0/coverage.rbs +50 -11
- data/stdlib/csv/0/csv.rbs +90 -119
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/date/0/date.rbs +806 -735
- data/stdlib/date/0/date_time.rbs +70 -211
- data/stdlib/dbm/0/dbm.rbs +0 -2
- data/stdlib/delegate/0/delegator.rbs +184 -0
- data/stdlib/delegate/0/kernel.rbs +47 -0
- data/stdlib/delegate/0/simple_delegator.rbs +96 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +3 -8
- data/stdlib/digest/0/digest.rbs +48 -35
- data/stdlib/erb/0/erb.rbs +15 -39
- data/stdlib/etc/0/etc.rbs +174 -54
- data/stdlib/fileutils/0/fileutils.rbs +1234 -385
- data/stdlib/forwardable/0/forwardable.rbs +4 -4
- data/stdlib/io-console/0/io-console.rbs +82 -17
- data/stdlib/ipaddr/0/ipaddr.rbs +11 -6
- data/stdlib/json/0/json.rbs +434 -151
- data/stdlib/kconv/0/kconv.rbs +166 -0
- data/stdlib/logger/0/formatter.rbs +0 -2
- data/stdlib/logger/0/log_device.rbs +1 -3
- data/stdlib/logger/0/logger.rbs +465 -328
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +7 -7
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/monitor/0/monitor.rbs +91 -10
- data/stdlib/mutex_m/0/mutex_m.rbs +0 -2
- data/stdlib/net-http/0/manifest.yaml +1 -1
- data/stdlib/net-http/0/net-http.rbs +3858 -964
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/net-smtp/0/manifest.yaml +2 -0
- data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
- data/stdlib/nkf/0/nkf.rbs +35 -5
- data/stdlib/objspace/0/objspace.rbs +40 -18
- data/stdlib/observable/0/observable.rbs +217 -0
- data/stdlib/open-uri/0/manifest.yaml +4 -0
- data/stdlib/open-uri/0/open-uri.rbs +393 -0
- data/stdlib/open3/0/open3.rbs +147 -0
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +681 -316
- data/stdlib/optparse/0/optparse.rbs +100 -65
- data/stdlib/pathname/0/pathname.rbs +24 -15
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +300 -0
- data/stdlib/prettyprint/0/prettyprint.rbs +2 -6
- data/stdlib/pstore/0/pstore.rbs +370 -156
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +402 -0
- data/stdlib/{yaml → psych}/0/store.rbs +2 -2
- data/stdlib/pty/0/pty.rbs +63 -11
- data/stdlib/rdoc/0/code_object.rbs +51 -0
- data/stdlib/rdoc/0/comment.rbs +59 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +117 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +13 -380
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/resolv/0/resolv.rbs +16 -79
- data/stdlib/ripper/0/ripper.rbs +1648 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -3
- data/stdlib/socket/0/addrinfo.rbs +13 -18
- data/stdlib/socket/0/basic_socket.rbs +5 -10
- data/stdlib/socket/0/ip_socket.rbs +0 -2
- data/stdlib/socket/0/socket.rbs +77 -46
- data/stdlib/socket/0/tcp_server.rbs +0 -5
- data/stdlib/socket/0/tcp_socket.rbs +36 -3
- data/stdlib/socket/0/udp_socket.rbs +4 -5
- data/stdlib/socket/0/unix_server.rbs +0 -5
- data/stdlib/socket/0/unix_socket.rbs +2 -4
- data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +188 -107
- data/stdlib/strscan/0/string_scanner.rbs +1269 -425
- data/stdlib/tempfile/0/tempfile.rbs +224 -61
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +17 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +271 -144
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +26 -22
- data/stdlib/uri/0/http.rbs +4 -4
- data/stdlib/uri/0/ldap.rbs +1 -1
- data/stdlib/uri/0/mailto.rbs +84 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/yaml/0/manifest.yaml +1 -2
- data/stdlib/yaml/0/yaml.rbs +1 -199
- data/stdlib/zlib/0/buf_error.rbs +10 -0
- data/stdlib/zlib/0/data_error.rbs +10 -0
- data/stdlib/zlib/0/deflate.rbs +210 -0
- data/stdlib/zlib/0/error.rbs +20 -0
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
- data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
- data/stdlib/zlib/0/gzip_file.rbs +156 -0
- data/stdlib/zlib/0/gzip_reader.rbs +293 -0
- data/stdlib/zlib/0/gzip_writer.rbs +166 -0
- data/stdlib/zlib/0/inflate.rbs +180 -0
- data/stdlib/zlib/0/mem_error.rbs +10 -0
- data/stdlib/zlib/0/need_dict.rbs +13 -0
- data/stdlib/zlib/0/stream_end.rbs +11 -0
- data/stdlib/zlib/0/stream_error.rbs +11 -0
- data/stdlib/zlib/0/version_error.rbs +11 -0
- data/stdlib/zlib/0/zlib.rbs +1 -3
- data/stdlib/zlib/0/zstream.rbs +200 -0
- data/templates/include/rbs/constants.h.erb +20 -0
- data/templates/include/rbs/ruby_objs.h.erb +10 -0
- data/templates/src/constants.c.erb +36 -0
- data/templates/src/ruby_objs.c.erb +27 -0
- data/templates/template.rb +122 -0
- metadata +136 -36
- data/Gemfile +0 -33
- data/Gemfile.lock +0 -118
- data/core/deprecated.rbs +0 -9
- data/ext/rbs_extension/constants.c +0 -135
- data/ext/rbs_extension/ruby_objs.c +0 -525
- data/ext/rbs_extension/ruby_objs.h +0 -43
- data/lib/rbs/constant_table.rb +0 -167
- data/lib/rbs/parser_compat/lexer_error.rb +0 -6
- data/lib/rbs/parser_compat/located_value.rb +0 -7
- data/lib/rbs/parser_compat/semantics_error.rb +0 -6
- data/lib/rbs/parser_compat/syntax_error.rb +0 -6
- data/lib/rbs/test/spy.rb +0 -6
- data/lib/rbs/type_name_resolver.rb +0 -67
- data/sig/constant_table.rbs +0 -30
- data/sig/shims/abstract_syntax_tree.rbs +0 -25
- data/sig/shims/pp.rbs +0 -3
- data/sig/shims/ripper.rbs +0 -8
- data/sig/shims.rbs +0 -69
- data/sig/type_name_resolver.rbs +0 -26
- data/stdlib/minitest/0/manifest.yaml +0 -2
- data/stdlib/prime/0/integer-extension.rbs +0 -41
- data/stdlib/prime/0/manifest.yaml +0 -2
- data/stdlib/prime/0/prime.rbs +0 -372
@@ -20,23 +20,21 @@
|
|
20
20
|
#
|
21
21
|
# key = OpenSSL::PKey::RSA.new 2048
|
22
22
|
#
|
23
|
-
#
|
24
|
-
#
|
23
|
+
# File.write 'private_key.pem', key.private_to_pem
|
24
|
+
# File.write 'public_key.pem', key.public_to_pem
|
25
25
|
#
|
26
26
|
# ### Exporting a Key
|
27
27
|
#
|
28
28
|
# Keys saved to disk without encryption are not secure as anyone who gets ahold
|
29
29
|
# of the key may use it unless it is encrypted. In order to securely export a
|
30
|
-
# key you may export it with a
|
30
|
+
# key you may export it with a password.
|
31
31
|
#
|
32
32
|
# cipher = OpenSSL::Cipher.new 'aes-256-cbc'
|
33
|
-
#
|
33
|
+
# password = 'my secure password goes here'
|
34
34
|
#
|
35
|
-
# key_secure = key.
|
35
|
+
# key_secure = key.private_to_pem cipher, password
|
36
36
|
#
|
37
|
-
#
|
38
|
-
# io.write key_secure
|
39
|
-
# end
|
37
|
+
# File.write 'private.secure.pem', key_secure
|
40
38
|
#
|
41
39
|
# OpenSSL::Cipher.ciphers returns a list of available ciphers.
|
42
40
|
#
|
@@ -56,13 +54,13 @@
|
|
56
54
|
#
|
57
55
|
# ### Loading an Encrypted Key
|
58
56
|
#
|
59
|
-
# OpenSSL will prompt you for your
|
60
|
-
# you will not be able to type in the
|
61
|
-
#
|
57
|
+
# OpenSSL will prompt you for your password when loading an encrypted key. If
|
58
|
+
# you will not be able to type in the password you may provide it when loading
|
59
|
+
# the key:
|
62
60
|
#
|
63
61
|
# key4_pem = File.read 'private.secure.pem'
|
64
|
-
#
|
65
|
-
# key4 = OpenSSL::PKey.read key4_pem,
|
62
|
+
# password = 'my secure password goes here'
|
63
|
+
# key4 = OpenSSL::PKey.read key4_pem, password
|
66
64
|
#
|
67
65
|
# ## RSA Encryption
|
68
66
|
#
|
@@ -175,44 +173,6 @@
|
|
175
173
|
# decrypted = cipher.update encrypted
|
176
174
|
# decrypted << cipher.final
|
177
175
|
#
|
178
|
-
# ## PKCS #5 Password-based Encryption
|
179
|
-
#
|
180
|
-
# PKCS #5 is a password-based encryption standard documented at
|
181
|
-
# [RFC2898](http://www.ietf.org/rfc/rfc2898.txt). It allows a short password or
|
182
|
-
# passphrase to be used to create a secure encryption key. If possible, PBKDF2
|
183
|
-
# as described above should be used if the circumstances allow it.
|
184
|
-
#
|
185
|
-
# PKCS #5 uses a Cipher, a pass phrase and a salt to generate an encryption key.
|
186
|
-
#
|
187
|
-
# pass_phrase = 'my secure pass phrase goes here'
|
188
|
-
# salt = '8 octets'
|
189
|
-
#
|
190
|
-
# ### Encryption
|
191
|
-
#
|
192
|
-
# First set up the cipher for encryption
|
193
|
-
#
|
194
|
-
# encryptor = OpenSSL::Cipher.new 'aes-256-cbc'
|
195
|
-
# encryptor.encrypt
|
196
|
-
# encryptor.pkcs5_keyivgen pass_phrase, salt
|
197
|
-
#
|
198
|
-
# Then pass the data you want to encrypt through
|
199
|
-
#
|
200
|
-
# encrypted = encryptor.update 'top secret document'
|
201
|
-
# encrypted << encryptor.final
|
202
|
-
#
|
203
|
-
# ### Decryption
|
204
|
-
#
|
205
|
-
# Use a new Cipher instance set up for decryption
|
206
|
-
#
|
207
|
-
# decryptor = OpenSSL::Cipher.new 'aes-256-cbc'
|
208
|
-
# decryptor.decrypt
|
209
|
-
# decryptor.pkcs5_keyivgen pass_phrase, salt
|
210
|
-
#
|
211
|
-
# Then pass the data you want to decrypt through
|
212
|
-
#
|
213
|
-
# plain = decryptor.update encrypted
|
214
|
-
# plain << decryptor.final
|
215
|
-
#
|
216
176
|
# ## X509 Certificates
|
217
177
|
#
|
218
178
|
# ### Creating a Certificate
|
@@ -290,12 +250,12 @@
|
|
290
250
|
# not readable by other users.
|
291
251
|
#
|
292
252
|
# ca_key = OpenSSL::PKey::RSA.new 2048
|
293
|
-
#
|
253
|
+
# password = 'my secure password goes here'
|
294
254
|
#
|
295
|
-
# cipher =
|
255
|
+
# cipher = 'aes-256-cbc'
|
296
256
|
#
|
297
257
|
# open 'ca_key.pem', 'w', 0400 do |io|
|
298
|
-
# io.write ca_key.
|
258
|
+
# io.write ca_key.private_to_pem(cipher, password)
|
299
259
|
# end
|
300
260
|
#
|
301
261
|
# ### CA Certificate
|
@@ -584,7 +544,20 @@ module OpenSSL
|
|
584
544
|
OPENSSL_VERSION: String
|
585
545
|
|
586
546
|
# <!-- rdoc-file=ext/openssl/ossl.c -->
|
587
|
-
# Version number of OpenSSL the ruby OpenSSL extension was built with (base 16)
|
547
|
+
# Version number of OpenSSL the ruby OpenSSL extension was built with (base 16).
|
548
|
+
# The formats are below.
|
549
|
+
#
|
550
|
+
# OpenSSL 3
|
551
|
+
# : `0xMNN00PP0 (major minor 00 patch 0)`
|
552
|
+
#
|
553
|
+
# OpenSSL before 3
|
554
|
+
# : `0xMNNFFPPS (major minor fix patch status)`
|
555
|
+
#
|
556
|
+
# LibreSSL
|
557
|
+
# : `0x20000000 (fixed value)`
|
558
|
+
#
|
559
|
+
#
|
560
|
+
# See also the man page OPENSSL_VERSION_NUMBER(3).
|
588
561
|
#
|
589
562
|
OPENSSL_VERSION_NUMBER: Integer
|
590
563
|
|
@@ -656,7 +629,6 @@ module OpenSSL
|
|
656
629
|
# * `:APPLICATION`
|
657
630
|
# * `:PRIVATE`
|
658
631
|
#
|
659
|
-
#
|
660
632
|
# ## Tag constants
|
661
633
|
#
|
662
634
|
# There is a constant defined for each universal tag:
|
@@ -684,12 +656,11 @@ module OpenSSL
|
|
684
656
|
# * OpenSSL::ASN1::UNIVERSALSTRING (28)
|
685
657
|
# * OpenSSL::ASN1::BMPSTRING (30)
|
686
658
|
#
|
687
|
-
#
|
688
659
|
# ## UNIVERSAL_TAG_NAME constant
|
689
660
|
#
|
690
661
|
# An Array that stores the name of a given tag number. These names are the same
|
691
662
|
# as the name of the tag constant that is additionally defined, e.g.
|
692
|
-
#
|
663
|
+
# `UNIVERSAL_TAG_NAME[2] = "INTEGER"` and `OpenSSL::ASN1::INTEGER = 2`.
|
693
664
|
#
|
694
665
|
# ## Example usage
|
695
666
|
#
|
@@ -804,7 +775,6 @@ module OpenSSL
|
|
804
775
|
# * tag_class: Current tag class (Symbol)
|
805
776
|
# * tag: The current tag number (Integer)
|
806
777
|
#
|
807
|
-
#
|
808
778
|
# ## Example
|
809
779
|
# der = File.binread('asn1data.der')
|
810
780
|
# OpenSSL::ASN1.traverse(der) do | depth, offset, header_len, length, constructed, tag_class, tag|
|
@@ -812,7 +782,7 @@ module OpenSSL
|
|
812
782
|
# puts "Header length: #{header_len} Tag: #{tag} Tag class: #{tag_class} Constructed: #{constructed}"
|
813
783
|
# end
|
814
784
|
#
|
815
|
-
def self.traverse: (String | _ToDer der) { (::Integer, ::Integer, ::Integer, ::Integer, bool, tag_class, ::Integer) -> void } -> void
|
785
|
+
def self.traverse: (String | _ToDer der) { ([::Integer, ::Integer, ::Integer, ::Integer, bool, tag_class, ::Integer]) -> void } -> void
|
816
786
|
|
817
787
|
BIT_STRING: Integer
|
818
788
|
|
@@ -900,7 +870,6 @@ module OpenSSL
|
|
900
870
|
# * *tag* equal to 1
|
901
871
|
# * *tag_class* equal to `:CONTEXT_SPECIFIC`
|
902
872
|
# * *value* equal to a String that carries the raw encoding of the INTEGER.
|
903
|
-
#
|
904
873
|
# This implies that a subsequent decoding step is required to completely decode
|
905
874
|
# implicitly tagged values.
|
906
875
|
#
|
@@ -913,7 +882,6 @@ module OpenSSL
|
|
913
882
|
# OpenSSL::ASN1::Integer, i.e. the inner element is the non-tagged primitive
|
914
883
|
# value, and the tagging is represented in the outer ASN1Data
|
915
884
|
#
|
916
|
-
#
|
917
885
|
# ## Example - Decoding an implicitly tagged INTEGER
|
918
886
|
# int = OpenSSL::ASN1::Integer.new(1, 0, :IMPLICIT) # implicit 0-tagged
|
919
887
|
# seq = OpenSSL::ASN1::Sequence.new( [int] )
|
@@ -963,9 +931,7 @@ module OpenSSL
|
|
963
931
|
# puts int2.value # => 1
|
964
932
|
#
|
965
933
|
class ASN1Data
|
966
|
-
|
967
|
-
|
968
|
-
# <!-- rdoc-file=ext/openssl/ossl_asn1.c -->
|
934
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
969
935
|
# Never `nil`. A boolean value indicating whether the encoding uses indefinite
|
970
936
|
# length (in the case of parsing) or whether an indefinite length form shall be
|
971
937
|
# used (in the encoding case). In DER, every value uses definite length form.
|
@@ -982,7 +948,7 @@ module OpenSSL
|
|
982
948
|
#
|
983
949
|
def indefinite_length: () -> bool
|
984
950
|
|
985
|
-
# <!-- rdoc-file=ext/openssl/
|
951
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
986
952
|
# Never `nil`. A boolean value indicating whether the encoding uses indefinite
|
987
953
|
# length (in the case of parsing) or whether an indefinite length form shall be
|
988
954
|
# used (in the encoding case). In DER, every value uses definite length form.
|
@@ -999,7 +965,7 @@ module OpenSSL
|
|
999
965
|
#
|
1000
966
|
def indefinite_length=: [U] (boolish) -> U
|
1001
967
|
|
1002
|
-
# <!-- rdoc-file=ext/openssl/
|
968
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1003
969
|
# Never `nil`. A boolean value indicating whether the encoding uses indefinite
|
1004
970
|
# length (in the case of parsing) or whether an indefinite length form shall be
|
1005
971
|
# used (in the encoding case). In DER, every value uses definite length form.
|
@@ -1016,7 +982,7 @@ module OpenSSL
|
|
1016
982
|
#
|
1017
983
|
alias infinite_length indefinite_length
|
1018
984
|
|
1019
|
-
# <!-- rdoc-file=ext/openssl/
|
985
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1020
986
|
# Never `nil`. A boolean value indicating whether the encoding uses indefinite
|
1021
987
|
# length (in the case of parsing) or whether an indefinite length form shall be
|
1022
988
|
# used (in the encoding case). In DER, every value uses definite length form.
|
@@ -1033,24 +999,24 @@ module OpenSSL
|
|
1033
999
|
#
|
1034
1000
|
alias infinite_length= indefinite_length=
|
1035
1001
|
|
1036
|
-
# <!-- rdoc-file=ext/openssl/
|
1002
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1037
1003
|
# An Integer representing the tag number of this ASN1Data. Never `nil`.
|
1038
1004
|
#
|
1039
1005
|
def tag: () -> bn
|
1040
1006
|
|
1041
|
-
# <!-- rdoc-file=ext/openssl/
|
1007
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1042
1008
|
# An Integer representing the tag number of this ASN1Data. Never `nil`.
|
1043
1009
|
#
|
1044
1010
|
def tag=: (::Integer) -> ::Integer
|
1045
1011
|
| (BN) -> BN
|
1046
1012
|
|
1047
|
-
# <!-- rdoc-file=ext/openssl/
|
1013
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1048
1014
|
# A Symbol representing the tag class of this ASN1Data. Never `nil`. See
|
1049
1015
|
# ASN1Data for possible values.
|
1050
1016
|
#
|
1051
1017
|
def tag_class: () -> tag_class
|
1052
1018
|
|
1053
|
-
# <!-- rdoc-file=ext/openssl/
|
1019
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1054
1020
|
# A Symbol representing the tag class of this ASN1Data. Never `nil`. See
|
1055
1021
|
# ASN1Data for possible values.
|
1056
1022
|
#
|
@@ -1067,13 +1033,13 @@ module OpenSSL
|
|
1067
1033
|
#
|
1068
1034
|
def to_der: () -> String
|
1069
1035
|
|
1070
|
-
# <!-- rdoc-file=ext/openssl/
|
1036
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1071
1037
|
# Carries the value of a ASN.1 type. Please confer Constructive and Primitive
|
1072
1038
|
# for the mappings between ASN.1 data types and Ruby classes.
|
1073
1039
|
#
|
1074
1040
|
def value: () -> untyped
|
1075
1041
|
|
1076
|
-
# <!-- rdoc-file=ext/openssl/
|
1042
|
+
# <!-- rdoc-file=ext/openssl/lib/openssl/asn1.rb -->
|
1077
1043
|
# Carries the value of a ASN.1 type. Please confer Constructive and Primitive
|
1078
1044
|
# for the mappings between ASN.1 data types and Ruby classes.
|
1079
1045
|
#
|
@@ -1082,7 +1048,7 @@ module OpenSSL
|
|
1082
1048
|
private
|
1083
1049
|
|
1084
1050
|
# <!--
|
1085
|
-
# rdoc-file=ext/openssl/
|
1051
|
+
# rdoc-file=ext/openssl/lib/openssl/asn1.rb
|
1086
1052
|
# - OpenSSL::ASN1::ASN1Data.new(value, tag, tag_class) => ASN1Data
|
1087
1053
|
# -->
|
1088
1054
|
# *value*: Please have a look at Constructive and Primitive to see how Ruby
|
@@ -1111,8 +1077,6 @@ module OpenSSL
|
|
1111
1077
|
end
|
1112
1078
|
|
1113
1079
|
class BitString < OpenSSL::ASN1::Primitive
|
1114
|
-
public
|
1115
|
-
|
1116
1080
|
def unused_bits: () -> ::Integer
|
1117
1081
|
|
1118
1082
|
def unused_bits=: (::Integer) -> ::Integer
|
@@ -1139,7 +1103,6 @@ module OpenSSL
|
|
1139
1103
|
# encodings are represented by one of the two sub-classes of Constructive:
|
1140
1104
|
# * OpenSSL::ASN1::Set
|
1141
1105
|
# * OpenSSL::ASN1::Sequence
|
1142
|
-
#
|
1143
1106
|
# Please note that tagged sequences and sets are still parsed as instances of
|
1144
1107
|
# ASN1Data. Find further details on tagged values there.
|
1145
1108
|
#
|
@@ -1156,10 +1119,8 @@ module OpenSSL
|
|
1156
1119
|
class Constructive < OpenSSL::ASN1::ASN1Data
|
1157
1120
|
include Enumerable[ASN1Data]
|
1158
1121
|
|
1159
|
-
public
|
1160
|
-
|
1161
1122
|
# <!--
|
1162
|
-
# rdoc-file=ext/openssl/
|
1123
|
+
# rdoc-file=ext/openssl/lib/openssl/asn1.rb
|
1163
1124
|
# - asn1_ary.each { |asn1| block } => asn1_ary
|
1164
1125
|
# -->
|
1165
1126
|
# Calls the given block once for each element in self, passing that element as
|
@@ -1221,12 +1182,15 @@ module OpenSSL
|
|
1221
1182
|
end
|
1222
1183
|
|
1223
1184
|
class EndOfContent < OpenSSL::ASN1::ASN1Data
|
1224
|
-
public
|
1225
|
-
|
1226
1185
|
def to_der: () -> String
|
1227
1186
|
|
1228
1187
|
private
|
1229
1188
|
|
1189
|
+
# <!--
|
1190
|
+
# rdoc-file=ext/openssl/lib/openssl/asn1.rb
|
1191
|
+
# - new()
|
1192
|
+
# -->
|
1193
|
+
#
|
1230
1194
|
def initialize: () -> void
|
1231
1195
|
end
|
1232
1196
|
|
@@ -1304,13 +1268,11 @@ module OpenSSL
|
|
1304
1268
|
|
1305
1269
|
def value=: (String) -> String
|
1306
1270
|
|
1307
|
-
public
|
1308
|
-
|
1309
1271
|
# <!--
|
1310
1272
|
# rdoc-file=ext/openssl/ossl_asn1.c
|
1311
1273
|
# - oid == other_oid => true or false
|
1312
1274
|
# -->
|
1313
|
-
# Returns `true` if *other_oid* is the same as *oid
|
1275
|
+
# Returns `true` if *other_oid* is the same as *oid*.
|
1314
1276
|
#
|
1315
1277
|
def ==: (ObjectId other) -> bool
|
1316
1278
|
|
@@ -1387,7 +1349,6 @@ module OpenSSL
|
|
1387
1349
|
# * OpenSSL::ASN1::UniversalString <=> *value* is a String
|
1388
1350
|
# * OpenSSL::ASN1::BMPString <=> *value* is a String
|
1389
1351
|
#
|
1390
|
-
#
|
1391
1352
|
# ## OpenSSL::ASN1::BitString
|
1392
1353
|
#
|
1393
1354
|
# ### Additional attributes
|
@@ -1408,7 +1369,6 @@ module OpenSSL
|
|
1408
1369
|
# * *short_name*: alias for *sn*.
|
1409
1370
|
# * *long_name*: alias for *ln*.
|
1410
1371
|
#
|
1411
|
-
#
|
1412
1372
|
# ## Examples
|
1413
1373
|
# With the Exception of OpenSSL::ASN1::EndOfContent, each Primitive class
|
1414
1374
|
# constructor takes at least one parameter, the *value*.
|
@@ -1422,8 +1382,6 @@ module OpenSSL
|
|
1422
1382
|
# prim_zero_tagged_explicit = <class>.new(value, 0, :EXPLICIT)
|
1423
1383
|
#
|
1424
1384
|
class Primitive < OpenSSL::ASN1::ASN1Data
|
1425
|
-
public
|
1426
|
-
|
1427
1385
|
# <!-- rdoc-file=ext/openssl/ossl_asn1.c -->
|
1428
1386
|
# May be used as a hint for encoding a value either implicitly or explicitly by
|
1429
1387
|
# setting it either to `:IMPLICIT` or to `:EXPLICIT`. *tagging* is not set when
|
@@ -1564,8 +1522,6 @@ module OpenSSL
|
|
1564
1522
|
#
|
1565
1523
|
def self.rand_range: (untyped) -> untyped
|
1566
1524
|
|
1567
|
-
public
|
1568
|
-
|
1569
1525
|
# <!--
|
1570
1526
|
# rdoc-file=ext/openssl/ossl_bn.c
|
1571
1527
|
# - bn % bn2 => aBN
|
@@ -1897,7 +1853,7 @@ module OpenSSL
|
|
1897
1853
|
# bignum is ignored.
|
1898
1854
|
# * `10` - Decimal number representation, with a leading '-' for a
|
1899
1855
|
# negative bignum.
|
1900
|
-
# * `16` -
|
1856
|
+
# * `16` - Hexadecimal number representation, with a leading '-' for a
|
1901
1857
|
# negative bignum.
|
1902
1858
|
#
|
1903
1859
|
def to_s: () -> String
|
@@ -1939,6 +1895,7 @@ module OpenSSL
|
|
1939
1895
|
#
|
1940
1896
|
# `string`
|
1941
1897
|
# : The string to be parsed.
|
1898
|
+
#
|
1942
1899
|
# `base`
|
1943
1900
|
# : The format. Must be one of the following:
|
1944
1901
|
# * `0` - MPI format. See the man page BN_mpi2bn(3) for details.
|
@@ -1946,7 +1903,7 @@ module OpenSSL
|
|
1946
1903
|
# number.
|
1947
1904
|
# * `10` - Decimal number representation, with a leading '-' for a
|
1948
1905
|
# negative number.
|
1949
|
-
# * `16` -
|
1906
|
+
# * `16` - Hexadecimal number representation, with a leading '-' for a
|
1950
1907
|
# negative number.
|
1951
1908
|
#
|
1952
1909
|
def initialize: (instance) -> void
|
@@ -1979,8 +1936,6 @@ module OpenSSL
|
|
1979
1936
|
module Buffering
|
1980
1937
|
include Enumerable[untyped]
|
1981
1938
|
|
1982
|
-
public
|
1983
|
-
|
1984
1939
|
# <!--
|
1985
1940
|
# rdoc-file=ext/openssl/lib/openssl/buffering.rb
|
1986
1941
|
# - <<(s)
|
@@ -2058,7 +2013,7 @@ module OpenSSL
|
|
2058
2013
|
|
2059
2014
|
# <!--
|
2060
2015
|
# rdoc-file=ext/openssl/lib/openssl/buffering.rb
|
2061
|
-
# - gets(eol=$/, limit=nil)
|
2016
|
+
# - gets(eol=$/, limit=nil, chomp: false)
|
2062
2017
|
# -->
|
2063
2018
|
# Reads the next "line" from the stream. Lines are separated by *eol*. If
|
2064
2019
|
# *limit* is provided the result will not be longer than the given number of
|
@@ -2519,8 +2474,6 @@ module OpenSSL
|
|
2519
2474
|
#
|
2520
2475
|
def self.ciphers: () -> Array[String]
|
2521
2476
|
|
2522
|
-
public
|
2523
|
-
|
2524
2477
|
# <!--
|
2525
2478
|
# rdoc-file=ext/openssl/ossl_cipher.c
|
2526
2479
|
# - cipher.auth_data = string -> string
|
@@ -2611,7 +2564,6 @@ module OpenSSL
|
|
2611
2564
|
#
|
2612
2565
|
# #key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen
|
2613
2566
|
# :
|
2614
|
-
#
|
2615
2567
|
# Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).
|
2616
2568
|
#
|
2617
2569
|
def decrypt: () -> self
|
@@ -2627,7 +2579,6 @@ module OpenSSL
|
|
2627
2579
|
#
|
2628
2580
|
# #key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen
|
2629
2581
|
# :
|
2630
|
-
#
|
2631
2582
|
# Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).
|
2632
2583
|
#
|
2633
2584
|
def encrypt: () -> self
|
@@ -2720,8 +2671,8 @@ module OpenSSL
|
|
2720
2671
|
# rdoc-file=ext/openssl/ossl_cipher.c
|
2721
2672
|
# - cipher.name -> string
|
2722
2673
|
# -->
|
2723
|
-
# Returns the name of the cipher which may differ slightly from the
|
2724
|
-
# name provided.
|
2674
|
+
# Returns the short name of the cipher which may differ slightly from the
|
2675
|
+
# original name provided.
|
2725
2676
|
#
|
2726
2677
|
def name: () -> String
|
2727
2678
|
|
@@ -2756,7 +2707,6 @@ module OpenSSL
|
|
2756
2707
|
# * *iterations* is an integer with a default of 2048.
|
2757
2708
|
# * *digest* is a Digest object that defaults to 'MD5'
|
2758
2709
|
#
|
2759
|
-
#
|
2760
2710
|
# A minimum of 1000 iterations is recommended.
|
2761
2711
|
#
|
2762
2712
|
def pkcs5_keyivgen: (String pass, ?String salt, ?Integer iterations, ?String digest) -> void
|
@@ -2937,8 +2887,6 @@ module OpenSSL
|
|
2937
2887
|
#
|
2938
2888
|
def self.parse_config: (IO io) -> Hash[String, Hash[String, String]]
|
2939
2889
|
|
2940
|
-
public
|
2941
|
-
|
2942
2890
|
# <!--
|
2943
2891
|
# rdoc-file=ext/openssl/ossl_config.c
|
2944
2892
|
# - config[section] -> hash
|
@@ -3077,19 +3025,16 @@ module OpenSSL
|
|
3077
3025
|
# -->
|
3078
3026
|
# Gets the parsable form of the current configuration.
|
3079
3027
|
#
|
3080
|
-
# Given the following configuration being
|
3028
|
+
# Given the following configuration file being loaded:
|
3081
3029
|
#
|
3082
|
-
# config = OpenSSL::Config.
|
3083
|
-
# #=> #<OpenSSL::Config sections=[]>
|
3084
|
-
# config['default'] = {"foo"=>"bar","baz"=>"buz"}
|
3085
|
-
# #=> {"foo"=>"bar", "baz"=>"buz"}
|
3030
|
+
# config = OpenSSL::Config.load('baz.cnf')
|
3031
|
+
# #=> #<OpenSSL::Config sections=["default"]>
|
3086
3032
|
# puts config.to_s
|
3087
3033
|
# #=> [ default ]
|
3088
3034
|
# # foo=bar
|
3089
3035
|
# # baz=buz
|
3090
3036
|
#
|
3091
|
-
# You can
|
3092
|
-
# later:
|
3037
|
+
# You can get the serialized configuration using #to_s and then parse it later:
|
3093
3038
|
#
|
3094
3039
|
# serialized_config = config.to_s
|
3095
3040
|
# # much later...
|
@@ -3174,7 +3119,6 @@ module OpenSSL
|
|
3174
3119
|
# * SHA3-224, SHA3-256, SHA3-384 and SHA3-512
|
3175
3120
|
# * BLAKE2s256 and BLAKE2b512
|
3176
3121
|
#
|
3177
|
-
#
|
3178
3122
|
# Each of these algorithms can be instantiated using the name:
|
3179
3123
|
#
|
3180
3124
|
# digest = OpenSSL::Digest.new('SHA256')
|
@@ -3213,7 +3157,7 @@ module OpenSSL
|
|
3213
3157
|
# sha256.reset
|
3214
3158
|
# digest2 = sha256.digest(data2)
|
3215
3159
|
#
|
3216
|
-
class Digest
|
3160
|
+
class Digest < ::Digest::Class
|
3217
3161
|
# <!--
|
3218
3162
|
# rdoc-file=ext/openssl/lib/openssl/digest.rb
|
3219
3163
|
# - digest(name, data)
|
@@ -3221,18 +3165,12 @@ module OpenSSL
|
|
3221
3165
|
# Return the hash value computed with *name* Digest. *name* is either the long
|
3222
3166
|
# name or short name of a supported digest algorithm.
|
3223
3167
|
#
|
3224
|
-
# ###
|
3168
|
+
# ### Example
|
3225
3169
|
#
|
3226
3170
|
# OpenSSL::Digest.digest("SHA256", "abc")
|
3227
3171
|
#
|
3228
|
-
# which is equivalent to:
|
3229
|
-
#
|
3230
|
-
# OpenSSL::Digest.digest('SHA256', "abc")
|
3231
|
-
#
|
3232
3172
|
def self.digest: (String name, String data) -> String
|
3233
3173
|
|
3234
|
-
public
|
3235
|
-
|
3236
3174
|
# <!-- rdoc-file=ext/openssl/ossl_digest.c -->
|
3237
3175
|
# Not every message digest can be computed in one single pass. If a message
|
3238
3176
|
# digest is to be computed from several subsequent sources, then each may be
|
@@ -3281,7 +3219,8 @@ module OpenSSL
|
|
3281
3219
|
# rdoc-file=ext/openssl/ossl_digest.c
|
3282
3220
|
# - digest.name -> string
|
3283
3221
|
# -->
|
3284
|
-
# Returns the
|
3222
|
+
# Returns the short name of this Digest algorithm which may differ slightly from
|
3223
|
+
# the original name provided.
|
3285
3224
|
#
|
3286
3225
|
# ### Example
|
3287
3226
|
# digest = OpenSSL::Digest.new('SHA512')
|
@@ -3328,7 +3267,8 @@ module OpenSSL
|
|
3328
3267
|
# - Digest.new(string [, data]) -> Digest
|
3329
3268
|
# -->
|
3330
3269
|
# Creates a Digest instance based on *string*, which is either the ln (long
|
3331
|
-
# name) or sn (short name) of a supported digest algorithm.
|
3270
|
+
# name) or sn (short name) of a supported digest algorithm. A list of supported
|
3271
|
+
# algorithms can be obtained by calling OpenSSL::Digest.digests.
|
3332
3272
|
#
|
3333
3273
|
# If *data* (a String) is given, it is used as the initial input to the Digest
|
3334
3274
|
# instance, i.e.
|
@@ -3489,8 +3429,6 @@ module OpenSSL
|
|
3489
3429
|
#
|
3490
3430
|
def self.load: (?String name) -> (true | nil)
|
3491
3431
|
|
3492
|
-
public
|
3493
|
-
|
3494
3432
|
# <!--
|
3495
3433
|
# rdoc-file=ext/openssl/ossl_engine.c
|
3496
3434
|
# - engine.cipher(name) -> OpenSSL::Cipher
|
@@ -3619,6 +3557,7 @@ module OpenSSL
|
|
3619
3557
|
#
|
3620
3558
|
# All flags
|
3621
3559
|
# : 0xFFFF
|
3560
|
+
#
|
3622
3561
|
# No flags
|
3623
3562
|
# : 0x0000
|
3624
3563
|
#
|
@@ -3722,7 +3661,22 @@ module OpenSSL
|
|
3722
3661
|
#
|
3723
3662
|
def self.hexdigest: (String | Digest algo, String key, String data) -> String
|
3724
3663
|
|
3725
|
-
|
3664
|
+
# <!--
|
3665
|
+
# rdoc-file=ext/openssl/lib/openssl/hmac.rb
|
3666
|
+
# - HMAC.base64digest(digest, key, data) -> aString
|
3667
|
+
# -->
|
3668
|
+
# Returns the authentication code as a Base64-encoded string. The *digest*
|
3669
|
+
# parameter specifies the digest algorithm to use. This may be a String
|
3670
|
+
# representing the algorithm name or an instance of OpenSSL::Digest.
|
3671
|
+
#
|
3672
|
+
# ### Example
|
3673
|
+
# key = 'key'
|
3674
|
+
# data = 'The quick brown fox jumps over the lazy dog'
|
3675
|
+
#
|
3676
|
+
# hmac = OpenSSL::HMAC.base64digest('SHA1', key, data)
|
3677
|
+
# #=> "3nybhbi3iqa8ino29wqQcBydtNk="
|
3678
|
+
#
|
3679
|
+
def self.base64digest: (String | Digest algo, String key, String data) -> String
|
3726
3680
|
|
3727
3681
|
# <!-- rdoc-file=ext/openssl/ossl_hmac.c -->
|
3728
3682
|
# Returns *hmac* updated with the message to be authenticated. Can be called
|
@@ -3771,6 +3725,14 @@ module OpenSSL
|
|
3771
3725
|
#
|
3772
3726
|
def hexdigest: () -> String
|
3773
3727
|
|
3728
|
+
# <!--
|
3729
|
+
# rdoc-file=ext/openssl/lib/openssl/hmac.rb
|
3730
|
+
# - hmac.base64digest -> string
|
3731
|
+
# -->
|
3732
|
+
# Returns the authentication code an a Base64-encoded string.
|
3733
|
+
#
|
3734
|
+
def base64digest: () -> String
|
3735
|
+
|
3774
3736
|
# <!-- rdoc-file=ext/openssl/lib/openssl/hmac.rb -->
|
3775
3737
|
# Returns the authentication code as a hex-encoded string. The *digest*
|
3776
3738
|
# parameter specifies the digest algorithm to use. This may be a String
|
@@ -3922,7 +3884,6 @@ module OpenSSL
|
|
3922
3884
|
# * scrypt
|
3923
3885
|
# * HKDF
|
3924
3886
|
#
|
3925
|
-
#
|
3926
3887
|
# ## Examples
|
3927
3888
|
# ### Generating a 128 bit key for a Cipher (e.g. AES)
|
3928
3889
|
# pass = "secret"
|
@@ -3957,26 +3918,30 @@ module OpenSSL
|
|
3957
3918
|
# - KDF.hkdf(ikm, salt:, info:, length:, hash:) -> String
|
3958
3919
|
# -->
|
3959
3920
|
# HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as specified in
|
3960
|
-
# [RFC 5869](https://
|
3921
|
+
# [RFC 5869](https://www.rfc-editor.org/rfc/rfc5869).
|
3961
3922
|
#
|
3962
3923
|
# New in OpenSSL 1.1.0.
|
3963
3924
|
#
|
3964
3925
|
# ### Parameters
|
3965
3926
|
# *ikm*
|
3966
3927
|
# : The input keying material.
|
3928
|
+
#
|
3967
3929
|
# *salt*
|
3968
3930
|
# : The salt.
|
3931
|
+
#
|
3969
3932
|
# *info*
|
3970
3933
|
# : The context and application specific information.
|
3934
|
+
#
|
3971
3935
|
# *length*
|
3972
3936
|
# : The output length in octets. Must be <= `255 * HashLen`, where HashLen is
|
3973
3937
|
# the length of the hash function output in octets.
|
3938
|
+
#
|
3974
3939
|
# *hash*
|
3975
3940
|
# : The hash function.
|
3976
3941
|
#
|
3977
3942
|
#
|
3978
3943
|
# ### Example
|
3979
|
-
# # The values from https://
|
3944
|
+
# # The values from https://www.rfc-editor.org/rfc/rfc5869#appendix-A.1
|
3980
3945
|
# ikm = ["0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"].pack("H*")
|
3981
3946
|
# salt = ["000102030405060708090a0b0c"].pack("H*")
|
3982
3947
|
# info = ["f0f1f2f3f4f5f6f7f8f9"].pack("H*")
|
@@ -3994,22 +3959,26 @@ module OpenSSL
|
|
3994
3959
|
# *length* bytes.
|
3995
3960
|
#
|
3996
3961
|
# For more information about PBKDF2, see RFC 2898 Section 5.2
|
3997
|
-
# (https://
|
3962
|
+
# (https://www.rfc-editor.org/rfc/rfc2898#section-5.2).
|
3998
3963
|
#
|
3999
3964
|
# ### Parameters
|
4000
3965
|
# pass
|
4001
|
-
# : The
|
3966
|
+
# : The password.
|
3967
|
+
#
|
4002
3968
|
# salt
|
4003
3969
|
# : The salt. Salts prevent attacks based on dictionaries of common passwords
|
4004
3970
|
# and attacks based on rainbow tables. It is a public value that can be
|
4005
3971
|
# safely stored along with the password (e.g. if the derived value is used
|
4006
3972
|
# for password storage).
|
3973
|
+
#
|
4007
3974
|
# iterations
|
4008
3975
|
# : The iteration count. This provides the ability to tune the algorithm. It
|
4009
3976
|
# is better to use the highest count possible for the maximum resistance to
|
4010
3977
|
# brute-force attacks.
|
3978
|
+
#
|
4011
3979
|
# length
|
4012
3980
|
# : The desired length of the derived key in octets.
|
3981
|
+
#
|
4013
3982
|
# hash
|
4014
3983
|
# : The hash algorithm used with HMAC for the PRF. May be a String
|
4015
3984
|
# representing the algorithm name, or an instance of OpenSSL::Digest.
|
@@ -4028,22 +3997,27 @@ module OpenSSL
|
|
4028
3997
|
# attacks using custom hardwares than alternative KDFs such as PBKDF2 or bcrypt.
|
4029
3998
|
#
|
4030
3999
|
# The keyword arguments *N*, *r* and *p* can be used to tune scrypt. RFC 7914
|
4031
|
-
# (published on 2016-08, https://
|
4032
|
-
# that using values r=8 and p=1 appears to yield good results.
|
4000
|
+
# (published on 2016-08, https://www.rfc-editor.org/rfc/rfc7914#section-2)
|
4001
|
+
# states that using values r=8 and p=1 appears to yield good results.
|
4033
4002
|
#
|
4034
|
-
# See RFC 7914 (https://
|
4003
|
+
# See RFC 7914 (https://www.rfc-editor.org/rfc/rfc7914) for more information.
|
4035
4004
|
#
|
4036
4005
|
# ### Parameters
|
4037
4006
|
# pass
|
4038
4007
|
# : Passphrase.
|
4008
|
+
#
|
4039
4009
|
# salt
|
4040
4010
|
# : Salt.
|
4011
|
+
#
|
4041
4012
|
# N
|
4042
4013
|
# : CPU/memory cost parameter. This must be a power of 2.
|
4014
|
+
#
|
4043
4015
|
# r
|
4044
4016
|
# : Block size parameter.
|
4017
|
+
#
|
4045
4018
|
# p
|
4046
4019
|
# : Parallelization parameter.
|
4020
|
+
#
|
4047
4021
|
# length
|
4048
4022
|
# : Length in octets of the derived key.
|
4049
4023
|
#
|
@@ -4079,8 +4053,6 @@ module OpenSSL
|
|
4079
4053
|
#
|
4080
4054
|
def self.included: (untyped base) -> untyped
|
4081
4055
|
|
4082
|
-
public
|
4083
|
-
|
4084
4056
|
# <!--
|
4085
4057
|
# rdoc-file=ext/openssl/lib/openssl/marshal.rb
|
4086
4058
|
# - _dump(_level)
|
@@ -4089,8 +4061,6 @@ module OpenSSL
|
|
4089
4061
|
def _dump: (untyped _level) -> untyped
|
4090
4062
|
|
4091
4063
|
module ClassMethods
|
4092
|
-
public
|
4093
|
-
|
4094
4064
|
# <!--
|
4095
4065
|
# rdoc-file=ext/openssl/lib/openssl/marshal.rb
|
4096
4066
|
# - _load(string)
|
@@ -4103,8 +4073,8 @@ module OpenSSL
|
|
4103
4073
|
# <!-- rdoc-file=ext/openssl/ossl_ns_spki.c -->
|
4104
4074
|
# OpenSSL::Netscape is a namespace for SPKI (Simple Public Key Infrastructure)
|
4105
4075
|
# which implements Signed Public Key and Challenge. See [RFC
|
4106
|
-
# 2692](
|
4107
|
-
# 2693](
|
4076
|
+
# 2692](https://www.rfc-editor.org/rfc/rfc2692) and [RFC
|
4077
|
+
# 2693](https://www.rfc-editor.org/rfc/rfc2692) for details.
|
4108
4078
|
#
|
4109
4079
|
module Netscape
|
4110
4080
|
# <!-- rdoc-file=ext/openssl/ossl_ns_spki.c -->
|
@@ -4145,8 +4115,6 @@ module OpenSSL
|
|
4145
4115
|
# #proceed
|
4146
4116
|
#
|
4147
4117
|
class SPKI
|
4148
|
-
public
|
4149
|
-
|
4150
4118
|
# <!--
|
4151
4119
|
# rdoc-file=ext/openssl/ossl_ns_spki.c
|
4152
4120
|
# - spki.challenge => string
|
@@ -4162,7 +4130,6 @@ module OpenSSL
|
|
4162
4130
|
# ### Parameters
|
4163
4131
|
# * *str* - the challenge string to be set for this instance
|
4164
4132
|
#
|
4165
|
-
#
|
4166
4133
|
# Sets the challenge to be associated with the SPKI. May be used by the server,
|
4167
4134
|
# e.g. to prevent replay.
|
4168
4135
|
#
|
@@ -4183,7 +4150,6 @@ module OpenSSL
|
|
4183
4150
|
# ### Parameters
|
4184
4151
|
# * *pub* - the public key to be set for this instance
|
4185
4152
|
#
|
4186
|
-
#
|
4187
4153
|
# Sets the public key to be associated with the SPKI, an instance of
|
4188
4154
|
# OpenSSL::PKey. This should be the public key corresponding to the private key
|
4189
4155
|
# used for signing the SPKI.
|
@@ -4198,7 +4164,6 @@ module OpenSSL
|
|
4198
4164
|
# * *key* - the private key to be used for signing this instance
|
4199
4165
|
# * *digest* - the digest to be used for signing this instance
|
4200
4166
|
#
|
4201
|
-
#
|
4202
4167
|
# To sign an SPKI, the private key corresponding to the public key set for this
|
4203
4168
|
# instance should be used, in addition to a digest algorithm in the form of an
|
4204
4169
|
# OpenSSL::Digest. The private key should be an instance of OpenSSL::PKey.
|
@@ -4241,7 +4206,6 @@ module OpenSSL
|
|
4241
4206
|
# ### Parameters
|
4242
4207
|
# * *key* - the public key to be used for verifying the SPKI signature
|
4243
4208
|
#
|
4244
|
-
#
|
4245
4209
|
# Returns `true` if the signature is valid, `false` otherwise. To verify an
|
4246
4210
|
# SPKI, the public key contained within the SPKI should be used.
|
4247
4211
|
#
|
@@ -4312,7 +4276,7 @@ module OpenSSL
|
|
4312
4276
|
# require 'net/http'
|
4313
4277
|
#
|
4314
4278
|
# http_response =
|
4315
|
-
# Net::HTTP.start ocsp_uri.hostname,
|
4279
|
+
# Net::HTTP.start ocsp_uri.hostname, ocsp_uri.port do |http|
|
4316
4280
|
# http.post ocsp_uri.path, request.to_der,
|
4317
4281
|
# 'content-type' => 'application/ocsp-request'
|
4318
4282
|
# end
|
@@ -4538,8 +4502,6 @@ module OpenSSL
|
|
4538
4502
|
# detailed than a Response.
|
4539
4503
|
#
|
4540
4504
|
class BasicResponse
|
4541
|
-
public
|
4542
|
-
|
4543
4505
|
# <!--
|
4544
4506
|
# rdoc-file=ext/openssl/ossl_ocsp.c
|
4545
4507
|
# - basic_response.add_nonce(nonce = nil)
|
@@ -4560,7 +4522,6 @@ module OpenSSL
|
|
4560
4522
|
# * OpenSSL::OCSP::V_CERTSTATUS_REVOKED
|
4561
4523
|
# * OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN
|
4562
4524
|
#
|
4563
|
-
#
|
4564
4525
|
# *reason* and *revocation_time* can be given only when *status* is
|
4565
4526
|
# OpenSSL::OCSP::V_CERTSTATUS_REVOKED. *reason* describes the reason for the
|
4566
4527
|
# revocation, and must be one of OpenSSL::OCSP::REVOKED_STATUS_* constants.
|
@@ -4615,8 +4576,10 @@ module OpenSSL
|
|
4615
4576
|
# *flags* can include:
|
4616
4577
|
# OpenSSL::OCSP::NOCERTS
|
4617
4578
|
# : don't include certificates
|
4579
|
+
#
|
4618
4580
|
# OpenSSL::OCSP::NOTIME
|
4619
4581
|
# : don't set producedAt
|
4582
|
+
#
|
4620
4583
|
# OpenSSL::OCSP::RESPID_KEY
|
4621
4584
|
# : use signer's public key hash as responderID
|
4622
4585
|
#
|
@@ -4677,8 +4640,6 @@ module OpenSSL
|
|
4677
4640
|
# status check can be performed.
|
4678
4641
|
#
|
4679
4642
|
class CertificateId
|
4680
|
-
public
|
4681
|
-
|
4682
4643
|
# <!--
|
4683
4644
|
# rdoc-file=ext/openssl/ossl_ocsp.c
|
4684
4645
|
# - certificate_id.cmp(other) -> true or false
|
@@ -4780,8 +4741,6 @@ module OpenSSL
|
|
4780
4741
|
# certificate or from a DER-encoded request created elsewhere.
|
4781
4742
|
#
|
4782
4743
|
class Request
|
4783
|
-
public
|
4784
|
-
|
4785
4744
|
# <!--
|
4786
4745
|
# rdoc-file=ext/openssl/ossl_ocsp.c
|
4787
4746
|
# - request.add_certid(certificate_id) -> request
|
@@ -4820,12 +4779,16 @@ module OpenSSL
|
|
4820
4779
|
#
|
4821
4780
|
# -1
|
4822
4781
|
# : nonce in request only.
|
4782
|
+
#
|
4823
4783
|
# 0
|
4824
4784
|
# : nonces both present and not equal.
|
4785
|
+
#
|
4825
4786
|
# 1
|
4826
4787
|
# : nonces present and equal.
|
4788
|
+
#
|
4827
4789
|
# 2
|
4828
4790
|
# : nonces both absent.
|
4791
|
+
#
|
4829
4792
|
# 3
|
4830
4793
|
# : nonce present in response only.
|
4831
4794
|
#
|
@@ -4917,8 +4880,6 @@ module OpenSSL
|
|
4917
4880
|
#
|
4918
4881
|
def self.create: (Integer status, ?BasicResponse response) -> instance
|
4919
4882
|
|
4920
|
-
public
|
4921
|
-
|
4922
4883
|
# <!--
|
4923
4884
|
# rdoc-file=ext/openssl/ossl_ocsp.c
|
4924
4885
|
# - response.basic
|
@@ -4976,8 +4937,6 @@ module OpenSSL
|
|
4976
4937
|
# which contains the basic information of the status of the certificate.
|
4977
4938
|
#
|
4978
4939
|
class SingleResponse
|
4979
|
-
public
|
4980
|
-
|
4981
4940
|
# <!--
|
4982
4941
|
# rdoc-file=ext/openssl/ossl_ocsp.c
|
4983
4942
|
# - single_response.cert_status -> Integer
|
@@ -4989,7 +4948,6 @@ module OpenSSL
|
|
4989
4948
|
# * V_CERTSTATUS_REVOKED
|
4990
4949
|
# * V_CERTSTATUS_UNKNOWN
|
4991
4950
|
#
|
4992
|
-
#
|
4993
4951
|
# When the status is V_CERTSTATUS_REVOKED, the time at which the certificate was
|
4994
4952
|
# revoked can be retrieved by #revocation_time.
|
4995
4953
|
#
|
@@ -5106,7 +5064,6 @@ module OpenSSL
|
|
5106
5064
|
# * The public_key portion of the certificate must contain a valid public
|
5107
5065
|
# key.
|
5108
5066
|
# * The not_before and not_after fields must be filled in.
|
5109
|
-
#
|
5110
5067
|
# * *ca* - An optional array of X509::Certificate's.
|
5111
5068
|
# * *key_pbe* - string
|
5112
5069
|
# * *cert_pbe* - string
|
@@ -5114,7 +5071,6 @@ module OpenSSL
|
|
5114
5071
|
# * *mac_iter* - integer
|
5115
5072
|
# * *keytype* - An integer representing an MSIE specific extension.
|
5116
5073
|
#
|
5117
|
-
#
|
5118
5074
|
# Any optional arguments may be supplied as `nil` to preserve the OpenSSL
|
5119
5075
|
# defaults.
|
5120
5076
|
#
|
@@ -5122,8 +5078,6 @@ module OpenSSL
|
|
5122
5078
|
#
|
5123
5079
|
def self.create: (String pass, String name, PKey::PKey key, X509::Certificate cert, ?Array[X509::Certificate]? ca, ?String? key_pbe, ?String? cert_pbe, ?Integer? key_iter, ?Integer? mac_iter, ?Integer? keytype) -> instance
|
5124
5080
|
|
5125
|
-
public
|
5126
|
-
|
5127
5081
|
def ca_certs: () -> Array[X509::Certificate]?
|
5128
5082
|
|
5129
5083
|
def certificate: () -> X509::Certificate
|
@@ -5189,8 +5143,13 @@ module OpenSSL
|
|
5189
5143
|
class PKCS7
|
5190
5144
|
# <!--
|
5191
5145
|
# rdoc-file=ext/openssl/ossl_pkcs7.c
|
5192
|
-
# - PKCS7.encrypt(certs, data,
|
5146
|
+
# - PKCS7.encrypt(certs, data, cipher, flags = 0) => pkcs7
|
5193
5147
|
# -->
|
5148
|
+
# Creates a PKCS #7 enveloped-data structure.
|
5149
|
+
#
|
5150
|
+
# Before version 3.3.0, `cipher` was optional and defaulted to `"RC2-40-CBC"`.
|
5151
|
+
#
|
5152
|
+
# See also the man page PKCS7_encrypt(3).
|
5194
5153
|
#
|
5195
5154
|
def self.encrypt: (X509::Certificate certs, String data, ?Cipher cipher, ?Integer flags) -> instance
|
5196
5155
|
|
@@ -5215,8 +5174,6 @@ module OpenSSL
|
|
5215
5174
|
#
|
5216
5175
|
def self.write_smime: (instance pkcs7, ?String data, ?Integer flags) -> String
|
5217
5176
|
|
5218
|
-
public
|
5219
|
-
|
5220
5177
|
# <!--
|
5221
5178
|
# rdoc-file=ext/openssl/ossl_pkcs7.c
|
5222
5179
|
# - add_certificate(p1)
|
@@ -5426,8 +5383,6 @@ module OpenSSL
|
|
5426
5383
|
end
|
5427
5384
|
|
5428
5385
|
class RecipientInfo
|
5429
|
-
public
|
5430
|
-
|
5431
5386
|
# <!--
|
5432
5387
|
# rdoc-file=ext/openssl/ossl_pkcs7.c
|
5433
5388
|
# - enc_key()
|
@@ -5460,8 +5415,6 @@ module OpenSSL
|
|
5460
5415
|
end
|
5461
5416
|
|
5462
5417
|
class SignerInfo
|
5463
|
-
public
|
5464
|
-
|
5465
5418
|
# <!--
|
5466
5419
|
# rdoc-file=ext/openssl/ossl_pkcs7.c
|
5467
5420
|
# - issuer()
|
@@ -5524,7 +5477,6 @@ module OpenSSL
|
|
5524
5477
|
# * RSA (OpenSSL::PKey::RSA)
|
5525
5478
|
# * DSA (OpenSSL::PKey::DSA)
|
5526
5479
|
# * Elliptic Curve Cryptography (OpenSSL::PKey::EC)
|
5527
|
-
#
|
5528
5480
|
# Each of these implementations is in fact a sub-class of the abstract PKey
|
5529
5481
|
# class which offers the interface for supporting digital signatures in the form
|
5530
5482
|
# of PKey#sign and PKey#verify.
|
@@ -5567,11 +5519,14 @@ module OpenSSL
|
|
5567
5519
|
# ### Accessor methods for the Diffie-Hellman parameters
|
5568
5520
|
# DH#p
|
5569
5521
|
# : The prime (an OpenSSL::BN) of the Diffie-Hellman parameters.
|
5522
|
+
#
|
5570
5523
|
# DH#g
|
5571
5524
|
# : The generator (an OpenSSL::BN) g of the Diffie-Hellman parameters.
|
5525
|
+
#
|
5572
5526
|
# DH#pub_key
|
5573
5527
|
# : The per-session public key (an OpenSSL::BN) matching the private key. This
|
5574
5528
|
# needs to be passed to DH#compute_key.
|
5529
|
+
#
|
5575
5530
|
# DH#priv_key
|
5576
5531
|
# : The per-session private key, an OpenSSL::BN.
|
5577
5532
|
#
|
@@ -5608,13 +5563,12 @@ module OpenSSL
|
|
5608
5563
|
#
|
5609
5564
|
# `size`
|
5610
5565
|
# : The desired key size in bits.
|
5566
|
+
#
|
5611
5567
|
# `generator`
|
5612
5568
|
# : The generator.
|
5613
5569
|
#
|
5614
5570
|
def self.generate: (Integer size, ?Integer generator) -> instance
|
5615
5571
|
|
5616
|
-
public
|
5617
|
-
|
5618
5572
|
# <!--
|
5619
5573
|
# rdoc-file=ext/openssl/lib/openssl/pkey.rb
|
5620
5574
|
# - dh.compute_key(pub_bn) -> string
|
@@ -5637,9 +5591,20 @@ module OpenSSL
|
|
5637
5591
|
# - dh.to_pem -> aString
|
5638
5592
|
# - dh.to_s -> aString
|
5639
5593
|
# -->
|
5640
|
-
#
|
5641
|
-
#
|
5642
|
-
#
|
5594
|
+
# Serializes the DH parameters to a PEM-encoding.
|
5595
|
+
#
|
5596
|
+
# Note that any existing per-session public/private keys will **not** get
|
5597
|
+
# encoded, just the Diffie-Hellman parameters will be encoded.
|
5598
|
+
#
|
5599
|
+
# PEM-encoded parameters will look like:
|
5600
|
+
#
|
5601
|
+
# -----BEGIN DH PARAMETERS-----
|
5602
|
+
# [...]
|
5603
|
+
# -----END DH PARAMETERS-----
|
5604
|
+
#
|
5605
|
+
# See also #public_to_pem (X.509 SubjectPublicKeyInfo) and #private_to_pem (PKCS
|
5606
|
+
# #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for serialization with the
|
5607
|
+
# private or public key components.
|
5643
5608
|
#
|
5644
5609
|
def export: () -> String
|
5645
5610
|
|
@@ -5765,23 +5730,50 @@ module OpenSSL
|
|
5765
5730
|
# rdoc-file=ext/openssl/ossl_pkey_dh.c
|
5766
5731
|
# - dh.to_der -> aString
|
5767
5732
|
# -->
|
5768
|
-
#
|
5769
|
-
#
|
5770
|
-
#
|
5733
|
+
# Serializes the DH parameters to a DER-encoding
|
5734
|
+
#
|
5735
|
+
# Note that any existing per-session public/private keys will **not** get
|
5736
|
+
# encoded, just the Diffie-Hellman parameters will be encoded.
|
5737
|
+
#
|
5738
|
+
# See also #public_to_der (X.509 SubjectPublicKeyInfo) and #private_to_der (PKCS
|
5739
|
+
# #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for serialization with the
|
5740
|
+
# private or public key components.
|
5771
5741
|
#
|
5772
5742
|
def to_der: () -> String
|
5773
5743
|
|
5774
5744
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_dh.c -->
|
5775
|
-
#
|
5776
|
-
#
|
5777
|
-
#
|
5745
|
+
# Serializes the DH parameters to a PEM-encoding.
|
5746
|
+
#
|
5747
|
+
# Note that any existing per-session public/private keys will **not** get
|
5748
|
+
# encoded, just the Diffie-Hellman parameters will be encoded.
|
5749
|
+
#
|
5750
|
+
# PEM-encoded parameters will look like:
|
5751
|
+
#
|
5752
|
+
# -----BEGIN DH PARAMETERS-----
|
5753
|
+
# [...]
|
5754
|
+
# -----END DH PARAMETERS-----
|
5755
|
+
#
|
5756
|
+
# See also #public_to_pem (X.509 SubjectPublicKeyInfo) and #private_to_pem (PKCS
|
5757
|
+
# #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for serialization with the
|
5758
|
+
# private or public key components.
|
5778
5759
|
#
|
5779
5760
|
alias to_pem export
|
5780
5761
|
|
5781
5762
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_dh.c -->
|
5782
|
-
#
|
5783
|
-
#
|
5784
|
-
#
|
5763
|
+
# Serializes the DH parameters to a PEM-encoding.
|
5764
|
+
#
|
5765
|
+
# Note that any existing per-session public/private keys will **not** get
|
5766
|
+
# encoded, just the Diffie-Hellman parameters will be encoded.
|
5767
|
+
#
|
5768
|
+
# PEM-encoded parameters will look like:
|
5769
|
+
#
|
5770
|
+
# -----BEGIN DH PARAMETERS-----
|
5771
|
+
# [...]
|
5772
|
+
# -----END DH PARAMETERS-----
|
5773
|
+
#
|
5774
|
+
# See also #public_to_pem (X.509 SubjectPublicKeyInfo) and #private_to_pem (PKCS
|
5775
|
+
# #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for serialization with the
|
5776
|
+
# private or public key components.
|
5785
5777
|
#
|
5786
5778
|
alias to_s export
|
5787
5779
|
|
@@ -5815,8 +5807,10 @@ module OpenSSL
|
|
5815
5807
|
#
|
5816
5808
|
# `string`
|
5817
5809
|
# : A String that contains the DER or PEM encoded key.
|
5810
|
+
#
|
5818
5811
|
# `size`
|
5819
5812
|
# : See DH.generate.
|
5813
|
+
#
|
5820
5814
|
# `generator`
|
5821
5815
|
# : See DH.generate.
|
5822
5816
|
#
|
@@ -5877,24 +5871,62 @@ module OpenSSL
|
|
5877
5871
|
#
|
5878
5872
|
def self.generate: (Integer size) -> instance
|
5879
5873
|
|
5880
|
-
public
|
5881
|
-
|
5882
5874
|
# <!--
|
5883
5875
|
# rdoc-file=ext/openssl/ossl_pkey_dsa.c
|
5884
5876
|
# - dsa.export([cipher, password]) -> aString
|
5885
5877
|
# - dsa.to_pem([cipher, password]) -> aString
|
5886
5878
|
# - dsa.to_s([cipher, password]) -> aString
|
5887
5879
|
# -->
|
5888
|
-
#
|
5880
|
+
# Serializes a private or public key to a PEM-encoding.
|
5889
5881
|
#
|
5890
|
-
#
|
5891
|
-
#
|
5892
|
-
# *
|
5882
|
+
# When the key contains public components only
|
5883
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
5884
|
+
# and *password* are ignored.
|
5893
5885
|
#
|
5886
|
+
# A PEM-encoded key will look like:
|
5894
5887
|
#
|
5895
|
-
#
|
5896
|
-
#
|
5897
|
-
#
|
5888
|
+
# -----BEGIN PUBLIC KEY-----
|
5889
|
+
# [...]
|
5890
|
+
# -----END PUBLIC KEY-----
|
5891
|
+
#
|
5892
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
5893
|
+
# X.509 SubjectPublicKeyInfo regardless of whether it is a public key or a
|
5894
|
+
# private key.
|
5895
|
+
#
|
5896
|
+
#
|
5897
|
+
# When the key contains private components, and no parameters are given
|
5898
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey.
|
5899
|
+
#
|
5900
|
+
# A PEM-encoded key will look like:
|
5901
|
+
#
|
5902
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
5903
|
+
# [...]
|
5904
|
+
# -----END DSA PRIVATE KEY-----
|
5905
|
+
#
|
5906
|
+
#
|
5907
|
+
# When the key contains private components, and *cipher* and *password* are given
|
5908
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey and encrypts it in
|
5909
|
+
# OpenSSL's traditional PEM encryption format. *cipher* must be a cipher
|
5910
|
+
# name understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
5911
|
+
#
|
5912
|
+
# An encrypted PEM-encoded key will look like:
|
5913
|
+
#
|
5914
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
5915
|
+
# Proc-Type: 4,ENCRYPTED
|
5916
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
5917
|
+
#
|
5918
|
+
# [...]
|
5919
|
+
# -----END DSA PRIVATE KEY-----
|
5920
|
+
#
|
5921
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
5922
|
+
# will not be available on FIPS-compliant systems.
|
5923
|
+
#
|
5924
|
+
#
|
5925
|
+
# **This method is kept for compatibility.** This should only be used when the
|
5926
|
+
# traditional, non-standard OpenSSL format is required.
|
5927
|
+
#
|
5928
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
5929
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
5898
5930
|
#
|
5899
5931
|
def export: (String cipher, String password) -> String
|
5900
5932
|
| () -> String
|
@@ -6009,6 +6041,7 @@ module OpenSSL
|
|
6009
6041
|
#
|
6010
6042
|
# `digest`
|
6011
6043
|
# : A message digest of the original input data to be signed.
|
6044
|
+
#
|
6012
6045
|
# `sig`
|
6013
6046
|
# : A DSA signature value.
|
6014
6047
|
#
|
@@ -6018,35 +6051,122 @@ module OpenSSL
|
|
6018
6051
|
# rdoc-file=ext/openssl/ossl_pkey_dsa.c
|
6019
6052
|
# - dsa.to_der -> aString
|
6020
6053
|
# -->
|
6021
|
-
#
|
6054
|
+
# Serializes a private or public key to a DER-encoding.
|
6055
|
+
#
|
6056
|
+
# See #to_pem for details.
|
6057
|
+
#
|
6058
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6059
|
+
# traditional, non-standard OpenSSL format is required.
|
6060
|
+
#
|
6061
|
+
# Consider using #public_to_der or #private_to_der instead.
|
6022
6062
|
#
|
6023
6063
|
def to_der: () -> String
|
6024
6064
|
|
6025
6065
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_dsa.c -->
|
6026
|
-
#
|
6066
|
+
# Serializes a private or public key to a PEM-encoding.
|
6027
6067
|
#
|
6028
|
-
#
|
6029
|
-
#
|
6030
|
-
# *
|
6068
|
+
# When the key contains public components only
|
6069
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
6070
|
+
# and *password* are ignored.
|
6031
6071
|
#
|
6072
|
+
# A PEM-encoded key will look like:
|
6073
|
+
#
|
6074
|
+
# -----BEGIN PUBLIC KEY-----
|
6075
|
+
# [...]
|
6076
|
+
# -----END PUBLIC KEY-----
|
6077
|
+
#
|
6078
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
6079
|
+
# X.509 SubjectPublicKeyInfo regardless of whether it is a public key or a
|
6080
|
+
# private key.
|
6081
|
+
#
|
6082
|
+
#
|
6083
|
+
# When the key contains private components, and no parameters are given
|
6084
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey.
|
6085
|
+
#
|
6086
|
+
# A PEM-encoded key will look like:
|
6087
|
+
#
|
6088
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
6089
|
+
# [...]
|
6090
|
+
# -----END DSA PRIVATE KEY-----
|
6091
|
+
#
|
6092
|
+
#
|
6093
|
+
# When the key contains private components, and *cipher* and *password* are given
|
6094
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey and encrypts it in
|
6095
|
+
# OpenSSL's traditional PEM encryption format. *cipher* must be a cipher
|
6096
|
+
# name understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
6097
|
+
#
|
6098
|
+
# An encrypted PEM-encoded key will look like:
|
6099
|
+
#
|
6100
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
6101
|
+
# Proc-Type: 4,ENCRYPTED
|
6102
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
6103
|
+
#
|
6104
|
+
# [...]
|
6105
|
+
# -----END DSA PRIVATE KEY-----
|
6106
|
+
#
|
6107
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
6108
|
+
# will not be available on FIPS-compliant systems.
|
6032
6109
|
#
|
6033
|
-
#
|
6034
|
-
#
|
6035
|
-
#
|
6110
|
+
#
|
6111
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6112
|
+
# traditional, non-standard OpenSSL format is required.
|
6113
|
+
#
|
6114
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
6115
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
6036
6116
|
#
|
6037
6117
|
alias to_pem export
|
6038
6118
|
|
6039
6119
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_dsa.c -->
|
6040
|
-
#
|
6120
|
+
# Serializes a private or public key to a PEM-encoding.
|
6041
6121
|
#
|
6042
|
-
#
|
6043
|
-
#
|
6044
|
-
# *
|
6122
|
+
# When the key contains public components only
|
6123
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
6124
|
+
# and *password* are ignored.
|
6045
6125
|
#
|
6126
|
+
# A PEM-encoded key will look like:
|
6046
6127
|
#
|
6047
|
-
#
|
6048
|
-
#
|
6049
|
-
#
|
6128
|
+
# -----BEGIN PUBLIC KEY-----
|
6129
|
+
# [...]
|
6130
|
+
# -----END PUBLIC KEY-----
|
6131
|
+
#
|
6132
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
6133
|
+
# X.509 SubjectPublicKeyInfo regardless of whether it is a public key or a
|
6134
|
+
# private key.
|
6135
|
+
#
|
6136
|
+
#
|
6137
|
+
# When the key contains private components, and no parameters are given
|
6138
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey.
|
6139
|
+
#
|
6140
|
+
# A PEM-encoded key will look like:
|
6141
|
+
#
|
6142
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
6143
|
+
# [...]
|
6144
|
+
# -----END DSA PRIVATE KEY-----
|
6145
|
+
#
|
6146
|
+
#
|
6147
|
+
# When the key contains private components, and *cipher* and *password* are given
|
6148
|
+
# : Serializes it into a traditional OpenSSL DSAPrivateKey and encrypts it in
|
6149
|
+
# OpenSSL's traditional PEM encryption format. *cipher* must be a cipher
|
6150
|
+
# name understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
6151
|
+
#
|
6152
|
+
# An encrypted PEM-encoded key will look like:
|
6153
|
+
#
|
6154
|
+
# -----BEGIN DSA PRIVATE KEY-----
|
6155
|
+
# Proc-Type: 4,ENCRYPTED
|
6156
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
6157
|
+
#
|
6158
|
+
# [...]
|
6159
|
+
# -----END DSA PRIVATE KEY-----
|
6160
|
+
#
|
6161
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
6162
|
+
# will not be available on FIPS-compliant systems.
|
6163
|
+
#
|
6164
|
+
#
|
6165
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6166
|
+
# traditional, non-standard OpenSSL format is required.
|
6167
|
+
#
|
6168
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
6169
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
6050
6170
|
#
|
6051
6171
|
alias to_s export
|
6052
6172
|
|
@@ -6080,8 +6200,10 @@ module OpenSSL
|
|
6080
6200
|
#
|
6081
6201
|
# `string`
|
6082
6202
|
# : A String that contains a DER or PEM encoded key.
|
6203
|
+
#
|
6083
6204
|
# `pass`
|
6084
6205
|
# : A String that contains an optional password.
|
6206
|
+
#
|
6085
6207
|
# `size`
|
6086
6208
|
# : See DSA.generate.
|
6087
6209
|
#
|
@@ -6153,8 +6275,6 @@ module OpenSSL
|
|
6153
6275
|
#
|
6154
6276
|
def self.generate: (String | Group pem_or_der_or_group_or_curve_name) -> instance
|
6155
6277
|
|
6156
|
-
public
|
6157
|
-
|
6158
6278
|
# <!--
|
6159
6279
|
# rdoc-file=ext/openssl/ossl_pkey_ec.c
|
6160
6280
|
# - key.check_key => true
|
@@ -6197,13 +6317,59 @@ module OpenSSL
|
|
6197
6317
|
|
6198
6318
|
# <!--
|
6199
6319
|
# rdoc-file=ext/openssl/ossl_pkey_ec.c
|
6200
|
-
# - key.export([cipher,
|
6201
|
-
# - key.to_pem([cipher,
|
6320
|
+
# - key.export([cipher, password]) => String
|
6321
|
+
# - key.to_pem([cipher, password]) => String
|
6202
6322
|
# -->
|
6203
|
-
#
|
6204
|
-
#
|
6205
|
-
#
|
6206
|
-
#
|
6323
|
+
# Serializes a private or public key to a PEM-encoding.
|
6324
|
+
#
|
6325
|
+
# When the key contains public components only
|
6326
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
6327
|
+
# and *password* are ignored.
|
6328
|
+
#
|
6329
|
+
# A PEM-encoded key will look like:
|
6330
|
+
#
|
6331
|
+
# -----BEGIN PUBLIC KEY-----
|
6332
|
+
# [...]
|
6333
|
+
# -----END PUBLIC KEY-----
|
6334
|
+
#
|
6335
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
6336
|
+
# X.509 SubjectPublicKeyInfo regardless of whether it is a public key or a
|
6337
|
+
# private key.
|
6338
|
+
#
|
6339
|
+
#
|
6340
|
+
# When the key contains private components, and no parameters are given
|
6341
|
+
# : Serializes it into a SEC 1/RFC 5915 ECPrivateKey.
|
6342
|
+
#
|
6343
|
+
# A PEM-encoded key will look like:
|
6344
|
+
#
|
6345
|
+
# -----BEGIN EC PRIVATE KEY-----
|
6346
|
+
# [...]
|
6347
|
+
# -----END EC PRIVATE KEY-----
|
6348
|
+
#
|
6349
|
+
#
|
6350
|
+
# When the key contains private components, and *cipher* and *password* are given
|
6351
|
+
# : Serializes it into a SEC 1/RFC 5915 ECPrivateKey and encrypts it in
|
6352
|
+
# OpenSSL's traditional PEM encryption format. *cipher* must be a cipher
|
6353
|
+
# name understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
6354
|
+
#
|
6355
|
+
# An encrypted PEM-encoded key will look like:
|
6356
|
+
#
|
6357
|
+
# -----BEGIN EC PRIVATE KEY-----
|
6358
|
+
# Proc-Type: 4,ENCRYPTED
|
6359
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
6360
|
+
#
|
6361
|
+
# [...]
|
6362
|
+
# -----END EC PRIVATE KEY-----
|
6363
|
+
#
|
6364
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
6365
|
+
# will not be available on FIPS-compliant systems.
|
6366
|
+
#
|
6367
|
+
#
|
6368
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6369
|
+
# SEC 1/RFC 5915 ECPrivateKey format is required.
|
6370
|
+
#
|
6371
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
6372
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
6207
6373
|
#
|
6208
6374
|
def export: (String cipher, String password) -> String
|
6209
6375
|
| () -> String
|
@@ -6321,15 +6487,68 @@ module OpenSSL
|
|
6321
6487
|
# rdoc-file=ext/openssl/ossl_pkey_ec.c
|
6322
6488
|
# - key.to_der => String
|
6323
6489
|
# -->
|
6324
|
-
#
|
6490
|
+
# Serializes a private or public key to a DER-encoding.
|
6491
|
+
#
|
6492
|
+
# See #to_pem for details.
|
6493
|
+
#
|
6494
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6495
|
+
# SEC 1/RFC 5915 ECPrivateKey format is required.
|
6496
|
+
#
|
6497
|
+
# Consider using #public_to_der or #private_to_der instead.
|
6325
6498
|
#
|
6326
6499
|
def to_der: () -> String
|
6327
6500
|
|
6328
6501
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_ec.c -->
|
6329
|
-
#
|
6330
|
-
#
|
6331
|
-
#
|
6332
|
-
#
|
6502
|
+
# Serializes a private or public key to a PEM-encoding.
|
6503
|
+
#
|
6504
|
+
# When the key contains public components only
|
6505
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
6506
|
+
# and *password* are ignored.
|
6507
|
+
#
|
6508
|
+
# A PEM-encoded key will look like:
|
6509
|
+
#
|
6510
|
+
# -----BEGIN PUBLIC KEY-----
|
6511
|
+
# [...]
|
6512
|
+
# -----END PUBLIC KEY-----
|
6513
|
+
#
|
6514
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
6515
|
+
# X.509 SubjectPublicKeyInfo regardless of whether it is a public key or a
|
6516
|
+
# private key.
|
6517
|
+
#
|
6518
|
+
#
|
6519
|
+
# When the key contains private components, and no parameters are given
|
6520
|
+
# : Serializes it into a SEC 1/RFC 5915 ECPrivateKey.
|
6521
|
+
#
|
6522
|
+
# A PEM-encoded key will look like:
|
6523
|
+
#
|
6524
|
+
# -----BEGIN EC PRIVATE KEY-----
|
6525
|
+
# [...]
|
6526
|
+
# -----END EC PRIVATE KEY-----
|
6527
|
+
#
|
6528
|
+
#
|
6529
|
+
# When the key contains private components, and *cipher* and *password* are given
|
6530
|
+
# : Serializes it into a SEC 1/RFC 5915 ECPrivateKey and encrypts it in
|
6531
|
+
# OpenSSL's traditional PEM encryption format. *cipher* must be a cipher
|
6532
|
+
# name understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
6533
|
+
#
|
6534
|
+
# An encrypted PEM-encoded key will look like:
|
6535
|
+
#
|
6536
|
+
# -----BEGIN EC PRIVATE KEY-----
|
6537
|
+
# Proc-Type: 4,ENCRYPTED
|
6538
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
6539
|
+
#
|
6540
|
+
# [...]
|
6541
|
+
# -----END EC PRIVATE KEY-----
|
6542
|
+
#
|
6543
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
6544
|
+
# will not be available on FIPS-compliant systems.
|
6545
|
+
#
|
6546
|
+
#
|
6547
|
+
# **This method is kept for compatibility.** This should only be used when the
|
6548
|
+
# SEC 1/RFC 5915 ECPrivateKey format is required.
|
6549
|
+
#
|
6550
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
6551
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
6333
6552
|
#
|
6334
6553
|
alias to_pem export
|
6335
6554
|
|
@@ -6375,8 +6594,6 @@ module OpenSSL
|
|
6375
6594
|
type point_conversion_format = :compressed | :uncompressed | :hybrid
|
6376
6595
|
|
6377
6596
|
class Group
|
6378
|
-
public
|
6379
|
-
|
6380
6597
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_ec.c -->
|
6381
6598
|
# Returns `true` if the two groups use the same curve and have the same
|
6382
6599
|
# parameters, `false` otherwise.
|
@@ -6405,7 +6622,6 @@ module OpenSSL
|
|
6405
6622
|
# * EC::NAMED_CURVE
|
6406
6623
|
# * EC::EXPLICIT_CURVE
|
6407
6624
|
#
|
6408
|
-
#
|
6409
6625
|
# See the OpenSSL documentation for EC_GROUP_set_asn1_flag().
|
6410
6626
|
#
|
6411
6627
|
def asn1_flag=: (Integer) -> Integer
|
@@ -6489,8 +6705,10 @@ module OpenSSL
|
|
6489
6705
|
# `:compressed`
|
6490
6706
|
# : Encoded as z||x, where z is an octet indicating which solution of the
|
6491
6707
|
# equation y is. z will be 0x02 or 0x03.
|
6708
|
+
#
|
6492
6709
|
# `:uncompressed`
|
6493
6710
|
# : Encoded as z||x||y, where z is an octet 0x04.
|
6711
|
+
#
|
6494
6712
|
# `:hybrid`
|
6495
6713
|
# : Encodes as z||x||y, where z is an octet indicating which solution of the
|
6496
6714
|
# equation y is. z will be 0x06 or 0x07.
|
@@ -6582,8 +6800,6 @@ module OpenSSL
|
|
6582
6800
|
end
|
6583
6801
|
|
6584
6802
|
class Point
|
6585
|
-
public
|
6586
|
-
|
6587
6803
|
# <!--
|
6588
6804
|
# rdoc-file=ext/openssl/ossl_pkey_ec.c
|
6589
6805
|
# - ==(p1)
|
@@ -6732,8 +6948,6 @@ module OpenSSL
|
|
6732
6948
|
# * OpenSSL::PKey::EC
|
6733
6949
|
#
|
6734
6950
|
class PKey
|
6735
|
-
public
|
6736
|
-
|
6737
6951
|
# <!--
|
6738
6952
|
# rdoc-file=ext/openssl/ossl_pkey.c
|
6739
6953
|
# - pkey.inspect -> string
|
@@ -6771,6 +6985,18 @@ module OpenSSL
|
|
6771
6985
|
# Serializes the private key to PEM-encoded PKCS #8 format. See #private_to_der
|
6772
6986
|
# for more details.
|
6773
6987
|
#
|
6988
|
+
# An unencrypted PEM-encoded key will look like:
|
6989
|
+
#
|
6990
|
+
# -----BEGIN PRIVATE KEY-----
|
6991
|
+
# [...]
|
6992
|
+
# -----END PRIVATE KEY-----
|
6993
|
+
#
|
6994
|
+
# An encrypted PEM-encoded key will look like:
|
6995
|
+
#
|
6996
|
+
# -----BEGIN ENCRYPTED PRIVATE KEY-----
|
6997
|
+
# [...]
|
6998
|
+
# -----END ENCRYPTED PRIVATE KEY-----
|
6999
|
+
#
|
6774
7000
|
def private_to_pem: (String cipher, String password) -> String
|
6775
7001
|
| () -> String
|
6776
7002
|
|
@@ -6788,6 +7014,12 @@ module OpenSSL
|
|
6788
7014
|
# -->
|
6789
7015
|
# Serializes the public key to PEM-encoded X.509 SubjectPublicKeyInfo format.
|
6790
7016
|
#
|
7017
|
+
# A PEM-encoded key will look like:
|
7018
|
+
#
|
7019
|
+
# -----BEGIN PUBLIC KEY-----
|
7020
|
+
# [...]
|
7021
|
+
# -----END PUBLIC KEY-----
|
7022
|
+
#
|
6791
7023
|
def public_to_pem: () -> String
|
6792
7024
|
|
6793
7025
|
# <!--
|
@@ -6806,8 +7038,10 @@ module OpenSSL
|
|
6806
7038
|
# the PKey type requires no digest algorithm. For backwards compatibility,
|
6807
7039
|
# this can be an instance of OpenSSL::Digest. Its state will not affect the
|
6808
7040
|
# signature.
|
7041
|
+
#
|
6809
7042
|
# `data`
|
6810
7043
|
# : A String. The data to be hashed and signed.
|
7044
|
+
#
|
6811
7045
|
# `options`
|
6812
7046
|
# : A Hash that contains algorithm specific control operations to OpenSSL. See
|
6813
7047
|
# OpenSSL's man page EVP_PKEY_CTX_ctrl_str(3) for details. `options`
|
@@ -6842,10 +7076,13 @@ module OpenSSL
|
|
6842
7076
|
#
|
6843
7077
|
# `digest`
|
6844
7078
|
# : See #sign.
|
7079
|
+
#
|
6845
7080
|
# `signature`
|
6846
7081
|
# : A String containing the signature to be verified.
|
7082
|
+
#
|
6847
7083
|
# `data`
|
6848
7084
|
# : See #sign.
|
7085
|
+
#
|
6849
7086
|
# `options`
|
6850
7087
|
# : See #sign. `options` parameter was added in version 3.0.
|
6851
7088
|
#
|
@@ -6892,13 +7129,12 @@ module OpenSSL
|
|
6892
7129
|
#
|
6893
7130
|
# `size`
|
6894
7131
|
# : The desired key size in bits.
|
7132
|
+
#
|
6895
7133
|
# `exponent`
|
6896
7134
|
# : An odd Integer, normally 3, 17, or 65537.
|
6897
7135
|
#
|
6898
7136
|
def self.generate: (Integer size, ?Integer exponent) -> instance
|
6899
7137
|
|
6900
|
-
public
|
6901
|
-
|
6902
7138
|
def d: () -> BN?
|
6903
7139
|
|
6904
7140
|
def dmp1: () -> BN?
|
@@ -6909,13 +7145,60 @@ module OpenSSL
|
|
6909
7145
|
|
6910
7146
|
# <!--
|
6911
7147
|
# rdoc-file=ext/openssl/ossl_pkey_rsa.c
|
6912
|
-
# - rsa.export([cipher,
|
6913
|
-
# - rsa.to_pem([cipher,
|
6914
|
-
# - rsa.to_s([cipher,
|
7148
|
+
# - rsa.export([cipher, password]) => PEM-format String
|
7149
|
+
# - rsa.to_pem([cipher, password]) => PEM-format String
|
7150
|
+
# - rsa.to_s([cipher, password]) => PEM-format String
|
6915
7151
|
# -->
|
6916
|
-
#
|
6917
|
-
#
|
6918
|
-
#
|
7152
|
+
# Serializes a private or public key to a PEM-encoding.
|
7153
|
+
#
|
7154
|
+
# When the key contains public components only
|
7155
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
7156
|
+
# and *password* are ignored.
|
7157
|
+
#
|
7158
|
+
# A PEM-encoded key will look like:
|
7159
|
+
#
|
7160
|
+
# -----BEGIN PUBLIC KEY-----
|
7161
|
+
# [...]
|
7162
|
+
# -----END PUBLIC KEY-----
|
7163
|
+
#
|
7164
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
7165
|
+
# X.509 SubjectPublicKeyInfo regardless of whether the key is a public key
|
7166
|
+
# or a private key.
|
7167
|
+
#
|
7168
|
+
#
|
7169
|
+
# When the key contains private components, and no parameters are given
|
7170
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey.
|
7171
|
+
#
|
7172
|
+
# A PEM-encoded key will look like:
|
7173
|
+
#
|
7174
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7175
|
+
# [...]
|
7176
|
+
# -----END RSA PRIVATE KEY-----
|
7177
|
+
#
|
7178
|
+
#
|
7179
|
+
# When the key contains private components, and *cipher* and *password* are given
|
7180
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey and encrypts it in OpenSSL's
|
7181
|
+
# traditional PEM encryption format. *cipher* must be a cipher name
|
7182
|
+
# understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
7183
|
+
#
|
7184
|
+
# An encrypted PEM-encoded key will look like:
|
7185
|
+
#
|
7186
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7187
|
+
# Proc-Type: 4,ENCRYPTED
|
7188
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
7189
|
+
#
|
7190
|
+
# [...]
|
7191
|
+
# -----END RSA PRIVATE KEY-----
|
7192
|
+
#
|
7193
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
7194
|
+
# will not be available on FIPS-compliant systems.
|
7195
|
+
#
|
7196
|
+
#
|
7197
|
+
# **This method is kept for compatibility.** This should only be used when the
|
7198
|
+
# PKCS #1 RSAPrivateKey format is required.
|
7199
|
+
#
|
7200
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
7201
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
6919
7202
|
#
|
6920
7203
|
def export: (String cipher, String password) -> String
|
6921
7204
|
| () -> String
|
@@ -6953,7 +7236,8 @@ module OpenSSL
|
|
6953
7236
|
# - rsa.private_decrypt(string, padding) -> String
|
6954
7237
|
# -->
|
6955
7238
|
# Decrypt `string`, which has been encrypted with the public key, with the
|
6956
|
-
# private key. `padding` defaults to PKCS1_PADDING
|
7239
|
+
# private key. `padding` defaults to PKCS1_PADDING, which is known to be
|
7240
|
+
# insecure but is kept for backwards compatibility.
|
6957
7241
|
#
|
6958
7242
|
# **Deprecated in version 3.0**. Consider using PKey::PKey#encrypt and
|
6959
7243
|
# PKey::PKey#decrypt instead.
|
@@ -6965,8 +7249,9 @@ module OpenSSL
|
|
6965
7249
|
# - rsa.private_encrypt(string) -> String
|
6966
7250
|
# - rsa.private_encrypt(string, padding) -> String
|
6967
7251
|
# -->
|
6968
|
-
# Encrypt `string` with the private key. `padding` defaults to PKCS1_PADDING
|
6969
|
-
#
|
7252
|
+
# Encrypt `string` with the private key. `padding` defaults to PKCS1_PADDING,
|
7253
|
+
# which is known to be insecure but is kept for backwards compatibility. The
|
7254
|
+
# encrypted string output can be decrypted using #public_decrypt.
|
6970
7255
|
#
|
6971
7256
|
# **Deprecated in version 3.0**. Consider using PKey::PKey#sign_raw and
|
6972
7257
|
# PKey::PKey#verify_raw, and PKey::PKey#verify_recover instead.
|
@@ -6988,7 +7273,8 @@ module OpenSSL
|
|
6988
7273
|
# - rsa.public_decrypt(string, padding) -> String
|
6989
7274
|
# -->
|
6990
7275
|
# Decrypt `string`, which has been encrypted with the private key, with the
|
6991
|
-
# public key. `padding` defaults to PKCS1_PADDING
|
7276
|
+
# public key. `padding` defaults to PKCS1_PADDING which is known to be insecure
|
7277
|
+
# but is kept for backwards compatibility.
|
6992
7278
|
#
|
6993
7279
|
# **Deprecated in version 3.0**. Consider using PKey::PKey#sign_raw and
|
6994
7280
|
# PKey::PKey#verify_raw, and PKey::PKey#verify_recover instead.
|
@@ -7000,8 +7286,9 @@ module OpenSSL
|
|
7000
7286
|
# - rsa.public_encrypt(string) -> String
|
7001
7287
|
# - rsa.public_encrypt(string, padding) -> String
|
7002
7288
|
# -->
|
7003
|
-
# Encrypt `string` with the public key. `padding` defaults to PKCS1_PADDING
|
7004
|
-
#
|
7289
|
+
# Encrypt `string` with the public key. `padding` defaults to PKCS1_PADDING,
|
7290
|
+
# which is known to be insecure but is kept for backwards compatibility. The
|
7291
|
+
# encrypted string output can be decrypted using #private_decrypt.
|
7005
7292
|
#
|
7006
7293
|
# **Deprecated in version 3.0**. Consider using PKey::PKey#encrypt and
|
7007
7294
|
# PKey::PKey#decrypt instead.
|
@@ -7063,13 +7350,16 @@ module OpenSSL
|
|
7063
7350
|
# ### Parameters
|
7064
7351
|
# *digest*
|
7065
7352
|
# : A String containing the message digest algorithm name.
|
7353
|
+
#
|
7066
7354
|
# *data*
|
7067
7355
|
# : A String. The data to be signed.
|
7356
|
+
#
|
7068
7357
|
# *salt_length*
|
7069
7358
|
# : The length in octets of the salt. Two special values are reserved:
|
7070
7359
|
# `:digest` means the digest length, and `:max` means the maximum possible
|
7071
7360
|
# length for the combination of the private key and the selected message
|
7072
7361
|
# digest algorithm.
|
7362
|
+
#
|
7073
7363
|
# *mgf1_hash*
|
7074
7364
|
# : The hash algorithm used in MGF1 (the currently supported mask generation
|
7075
7365
|
# function (MGF)).
|
@@ -7089,21 +7379,122 @@ module OpenSSL
|
|
7089
7379
|
# rdoc-file=ext/openssl/ossl_pkey_rsa.c
|
7090
7380
|
# - rsa.to_der => DER-format String
|
7091
7381
|
# -->
|
7092
|
-
#
|
7382
|
+
# Serializes a private or public key to a DER-encoding.
|
7383
|
+
#
|
7384
|
+
# See #to_pem for details.
|
7385
|
+
#
|
7386
|
+
# **This method is kept for compatibility.** This should only be used when the
|
7387
|
+
# PKCS #1 RSAPrivateKey format is required.
|
7388
|
+
#
|
7389
|
+
# Consider using #public_to_der or #private_to_der instead.
|
7093
7390
|
#
|
7094
7391
|
def to_der: () -> String
|
7095
7392
|
|
7096
7393
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_rsa.c -->
|
7097
|
-
#
|
7098
|
-
#
|
7099
|
-
#
|
7394
|
+
# Serializes a private or public key to a PEM-encoding.
|
7395
|
+
#
|
7396
|
+
# When the key contains public components only
|
7397
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
7398
|
+
# and *password* are ignored.
|
7399
|
+
#
|
7400
|
+
# A PEM-encoded key will look like:
|
7401
|
+
#
|
7402
|
+
# -----BEGIN PUBLIC KEY-----
|
7403
|
+
# [...]
|
7404
|
+
# -----END PUBLIC KEY-----
|
7405
|
+
#
|
7406
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
7407
|
+
# X.509 SubjectPublicKeyInfo regardless of whether the key is a public key
|
7408
|
+
# or a private key.
|
7409
|
+
#
|
7410
|
+
#
|
7411
|
+
# When the key contains private components, and no parameters are given
|
7412
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey.
|
7413
|
+
#
|
7414
|
+
# A PEM-encoded key will look like:
|
7415
|
+
#
|
7416
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7417
|
+
# [...]
|
7418
|
+
# -----END RSA PRIVATE KEY-----
|
7419
|
+
#
|
7420
|
+
#
|
7421
|
+
# When the key contains private components, and *cipher* and *password* are given
|
7422
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey and encrypts it in OpenSSL's
|
7423
|
+
# traditional PEM encryption format. *cipher* must be a cipher name
|
7424
|
+
# understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
7425
|
+
#
|
7426
|
+
# An encrypted PEM-encoded key will look like:
|
7427
|
+
#
|
7428
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7429
|
+
# Proc-Type: 4,ENCRYPTED
|
7430
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
7431
|
+
#
|
7432
|
+
# [...]
|
7433
|
+
# -----END RSA PRIVATE KEY-----
|
7434
|
+
#
|
7435
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
7436
|
+
# will not be available on FIPS-compliant systems.
|
7437
|
+
#
|
7438
|
+
#
|
7439
|
+
# **This method is kept for compatibility.** This should only be used when the
|
7440
|
+
# PKCS #1 RSAPrivateKey format is required.
|
7441
|
+
#
|
7442
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
7443
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
7100
7444
|
#
|
7101
7445
|
alias to_pem export
|
7102
7446
|
|
7103
7447
|
# <!-- rdoc-file=ext/openssl/ossl_pkey_rsa.c -->
|
7104
|
-
#
|
7105
|
-
#
|
7106
|
-
#
|
7448
|
+
# Serializes a private or public key to a PEM-encoding.
|
7449
|
+
#
|
7450
|
+
# When the key contains public components only
|
7451
|
+
# : Serializes it into an X.509 SubjectPublicKeyInfo. The parameters *cipher*
|
7452
|
+
# and *password* are ignored.
|
7453
|
+
#
|
7454
|
+
# A PEM-encoded key will look like:
|
7455
|
+
#
|
7456
|
+
# -----BEGIN PUBLIC KEY-----
|
7457
|
+
# [...]
|
7458
|
+
# -----END PUBLIC KEY-----
|
7459
|
+
#
|
7460
|
+
# Consider using #public_to_pem instead. This serializes the key into an
|
7461
|
+
# X.509 SubjectPublicKeyInfo regardless of whether the key is a public key
|
7462
|
+
# or a private key.
|
7463
|
+
#
|
7464
|
+
#
|
7465
|
+
# When the key contains private components, and no parameters are given
|
7466
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey.
|
7467
|
+
#
|
7468
|
+
# A PEM-encoded key will look like:
|
7469
|
+
#
|
7470
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7471
|
+
# [...]
|
7472
|
+
# -----END RSA PRIVATE KEY-----
|
7473
|
+
#
|
7474
|
+
#
|
7475
|
+
# When the key contains private components, and *cipher* and *password* are given
|
7476
|
+
# : Serializes it into a PKCS #1 RSAPrivateKey and encrypts it in OpenSSL's
|
7477
|
+
# traditional PEM encryption format. *cipher* must be a cipher name
|
7478
|
+
# understood by OpenSSL::Cipher.new or an instance of OpenSSL::Cipher.
|
7479
|
+
#
|
7480
|
+
# An encrypted PEM-encoded key will look like:
|
7481
|
+
#
|
7482
|
+
# -----BEGIN RSA PRIVATE KEY-----
|
7483
|
+
# Proc-Type: 4,ENCRYPTED
|
7484
|
+
# DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0
|
7485
|
+
#
|
7486
|
+
# [...]
|
7487
|
+
# -----END RSA PRIVATE KEY-----
|
7488
|
+
#
|
7489
|
+
# Note that this format uses MD5 to derive the encryption key, and hence
|
7490
|
+
# will not be available on FIPS-compliant systems.
|
7491
|
+
#
|
7492
|
+
#
|
7493
|
+
# **This method is kept for compatibility.** This should only be used when the
|
7494
|
+
# PKCS #1 RSAPrivateKey format is required.
|
7495
|
+
#
|
7496
|
+
# Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem
|
7497
|
+
# (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead.
|
7107
7498
|
#
|
7108
7499
|
alias to_s export
|
7109
7500
|
|
@@ -7133,12 +7524,15 @@ module OpenSSL
|
|
7133
7524
|
# ### Parameters
|
7134
7525
|
# *digest*
|
7135
7526
|
# : A String containing the message digest algorithm name.
|
7527
|
+
#
|
7136
7528
|
# *data*
|
7137
7529
|
# : A String. The data to be signed.
|
7530
|
+
#
|
7138
7531
|
# *salt_length*
|
7139
7532
|
# : The length in octets of the salt. Two special values are reserved:
|
7140
7533
|
# `:digest` means the digest length, and `:auto` means automatically
|
7141
7534
|
# determining the length based on the signature.
|
7535
|
+
#
|
7142
7536
|
# *mgf1_hash*
|
7143
7537
|
# : The hash algorithm used in MGF1.
|
7144
7538
|
#
|
@@ -7149,8 +7543,8 @@ module OpenSSL
|
|
7149
7543
|
# <!--
|
7150
7544
|
# rdoc-file=ext/openssl/ossl_pkey_rsa.c
|
7151
7545
|
# - RSA.new -> rsa
|
7152
|
-
# - RSA.new(encoded_key [,
|
7153
|
-
# - RSA.new(encoded_key) {
|
7546
|
+
# - RSA.new(encoded_key [, password ]) -> rsa
|
7547
|
+
# - RSA.new(encoded_key) { password } -> rsa
|
7154
7548
|
# - RSA.new(size [, exponent]) -> rsa
|
7155
7549
|
# -->
|
7156
7550
|
# Generates or loads an RSA keypair.
|
@@ -7160,9 +7554,9 @@ module OpenSSL
|
|
7160
7554
|
# #set_crt_params.
|
7161
7555
|
#
|
7162
7556
|
# If called with a String, tries to parse as DER or PEM encoding of an RSA key.
|
7163
|
-
# Note that
|
7164
|
-
#
|
7165
|
-
# parse keys of any
|
7557
|
+
# Note that if *password* is not specified, but the key is encrypted with a
|
7558
|
+
# password, OpenSSL will prompt for it. See also OpenSSL::PKey.read which can
|
7559
|
+
# parse keys of any kind.
|
7166
7560
|
#
|
7167
7561
|
# If called with a number, generates a new key pair. This form works as an alias
|
7168
7562
|
# of RSA.generate.
|
@@ -7170,7 +7564,7 @@ module OpenSSL
|
|
7170
7564
|
# Examples:
|
7171
7565
|
# OpenSSL::PKey::RSA.new 2048
|
7172
7566
|
# OpenSSL::PKey::RSA.new File.read 'rsa.pem'
|
7173
|
-
# OpenSSL::PKey::RSA.new File.read('rsa.pem'), 'my
|
7567
|
+
# OpenSSL::PKey::RSA.new File.read('rsa.pem'), 'my password'
|
7174
7568
|
#
|
7175
7569
|
def initialize: () -> void
|
7176
7570
|
| (Integer key_size) -> void
|
@@ -7471,8 +7865,6 @@ module OpenSSL
|
|
7471
7865
|
# be frozen afterward.
|
7472
7866
|
#
|
7473
7867
|
class SSLContext
|
7474
|
-
public
|
7475
|
-
|
7476
7868
|
# <!--
|
7477
7869
|
# rdoc-file=ext/openssl/ossl_ssl.c
|
7478
7870
|
# - ctx.add_certificate(certificate, pkey [, extra_certs]) -> self
|
@@ -7490,8 +7882,10 @@ module OpenSSL
|
|
7490
7882
|
# ### Parameters
|
7491
7883
|
# *certificate*
|
7492
7884
|
# : A certificate. An instance of OpenSSL::X509::Certificate.
|
7885
|
+
#
|
7493
7886
|
# *pkey*
|
7494
7887
|
# : The private key for *certificate*. An instance of OpenSSL::PKey::PKey.
|
7888
|
+
#
|
7495
7889
|
# *extra_certs*
|
7496
7890
|
# : Optional. An array of OpenSSL::X509::Certificate. When sending a
|
7497
7891
|
# certificate chain, the certificates specified by this are sent following
|
@@ -7850,7 +8244,7 @@ module OpenSSL
|
|
7850
8244
|
|
7851
8245
|
# <!--
|
7852
8246
|
# rdoc-file=ext/openssl/ossl_ssl.c
|
7853
|
-
# - options
|
8247
|
+
# - ctx.options -> integer
|
7854
8248
|
# -->
|
7855
8249
|
# Gets various OpenSSL options.
|
7856
8250
|
#
|
@@ -7858,9 +8252,16 @@ module OpenSSL
|
|
7858
8252
|
|
7859
8253
|
# <!--
|
7860
8254
|
# rdoc-file=ext/openssl/ossl_ssl.c
|
7861
|
-
# - options=
|
8255
|
+
# - ctx.options = integer
|
7862
8256
|
# -->
|
7863
|
-
# Sets various OpenSSL options.
|
8257
|
+
# Sets various OpenSSL options. The options are a bit field and can be combined
|
8258
|
+
# with the bitwise OR operator (`|`). Available options are defined as constants
|
8259
|
+
# in OpenSSL::SSL that begin with `OP_`.
|
8260
|
+
#
|
8261
|
+
# For backwards compatibility, passing `nil` has the same effect as passing
|
8262
|
+
# OpenSSL::SSL::OP_ALL.
|
8263
|
+
#
|
8264
|
+
# See also man page SSL_CTX_set_options(3).
|
7864
8265
|
#
|
7865
8266
|
def options=: (Integer ssl_options) -> Integer
|
7866
8267
|
|
@@ -8005,26 +8406,37 @@ module OpenSSL
|
|
8005
8406
|
#
|
8006
8407
|
# :accept
|
8007
8408
|
# : Number of started SSL/TLS handshakes in server mode
|
8409
|
+
#
|
8008
8410
|
# :accept_good
|
8009
8411
|
# : Number of established SSL/TLS sessions in server mode
|
8412
|
+
#
|
8010
8413
|
# :accept_renegotiate
|
8011
8414
|
# : Number of start renegotiations in server mode
|
8415
|
+
#
|
8012
8416
|
# :cache_full
|
8013
8417
|
# : Number of sessions that were removed due to cache overflow
|
8418
|
+
#
|
8014
8419
|
# :cache_hits
|
8015
8420
|
# : Number of successfully reused connections
|
8421
|
+
#
|
8016
8422
|
# :cache_misses
|
8017
8423
|
# : Number of sessions proposed by clients that were not found in the cache
|
8424
|
+
#
|
8018
8425
|
# :cache_num
|
8019
8426
|
# : Number of sessions in the internal session cache
|
8427
|
+
#
|
8020
8428
|
# :cb_hits
|
8021
8429
|
# : Number of sessions retrieved from the external cache in server mode
|
8430
|
+
#
|
8022
8431
|
# :connect
|
8023
8432
|
# : Number of started SSL/TLS handshakes in client mode
|
8433
|
+
#
|
8024
8434
|
# :connect_good
|
8025
8435
|
# : Number of established SSL/TLS sessions in client mode
|
8436
|
+
#
|
8026
8437
|
# :connect_renegotiate
|
8027
8438
|
# : Number of start renegotiations in client mode
|
8439
|
+
#
|
8028
8440
|
# :timeouts
|
8029
8441
|
# : Number of sessions proposed by clients that were found in the cache but
|
8030
8442
|
# had expired due to timeouts
|
@@ -8382,8 +8794,6 @@ module OpenSSL
|
|
8382
8794
|
class SSLServer
|
8383
8795
|
include OpenSSL::SSL::SocketForwarder
|
8384
8796
|
|
8385
|
-
public
|
8386
|
-
|
8387
8797
|
# <!--
|
8388
8798
|
# rdoc-file=ext/openssl/lib/openssl/ssl.rb
|
8389
8799
|
# - accept()
|
@@ -8414,7 +8824,7 @@ module OpenSSL
|
|
8414
8824
|
# -->
|
8415
8825
|
# See BasicSocket#shutdown for details.
|
8416
8826
|
#
|
8417
|
-
def shutdown: (
|
8827
|
+
def shutdown: (interned | Integer how) -> void
|
8418
8828
|
|
8419
8829
|
# <!-- rdoc-file=ext/openssl/lib/openssl/ssl.rb -->
|
8420
8830
|
# When true then #accept works exactly the same as TCPServer#accept
|
@@ -8474,8 +8884,6 @@ module OpenSSL
|
|
8474
8884
|
#
|
8475
8885
|
def self.open: (untyped remote_host, untyped remote_port, ?untyped local_host, ?untyped local_port, ?context: untyped) -> untyped
|
8476
8886
|
|
8477
|
-
public
|
8478
|
-
|
8479
8887
|
# <!--
|
8480
8888
|
# rdoc-file=ext/openssl/ossl_ssl.c
|
8481
8889
|
# - ssl.accept => self
|
@@ -8865,8 +9273,6 @@ module OpenSSL
|
|
8865
9273
|
end
|
8866
9274
|
|
8867
9275
|
class Session
|
8868
|
-
public
|
8869
|
-
|
8870
9276
|
# <!--
|
8871
9277
|
# rdoc-file=ext/openssl/ossl_ssl_session.c
|
8872
9278
|
# - session1 == session2 -> boolean
|
@@ -8965,8 +9371,6 @@ module OpenSSL
|
|
8965
9371
|
end
|
8966
9372
|
|
8967
9373
|
module SocketForwarder
|
8968
|
-
public
|
8969
|
-
|
8970
9374
|
# <!--
|
8971
9375
|
# rdoc-file=ext/openssl/lib/openssl/ssl.rb
|
8972
9376
|
# - addr()
|
@@ -9164,8 +9568,6 @@ module OpenSSL
|
|
9164
9568
|
# factory.allowed_digests -> array or nil
|
9165
9569
|
#
|
9166
9570
|
class Factory
|
9167
|
-
public
|
9168
|
-
|
9169
9571
|
def additional_certs: () -> Array[X509::Certificate]?
|
9170
9572
|
|
9171
9573
|
def additional_certs=: (Array[X509::Certificate]? certs) -> Array[X509::Certificate]?
|
@@ -9187,13 +9589,11 @@ module OpenSSL
|
|
9187
9589
|
# * Request#algorithm
|
9188
9590
|
# * Request#message_imprint
|
9189
9591
|
#
|
9190
|
-
#
|
9191
9592
|
# Mandatory parameters that need to be set in the Factory:
|
9192
9593
|
# * Factory#serial_number
|
9193
9594
|
# * Factory#gen_time
|
9194
9595
|
# * Factory#allowed_digests
|
9195
9596
|
#
|
9196
|
-
#
|
9197
9597
|
# In addition one of either Request#policy_id or Factory#default_policy_id must
|
9198
9598
|
# be set.
|
9199
9599
|
#
|
@@ -9224,8 +9624,6 @@ module OpenSSL
|
|
9224
9624
|
# * algorithm, message_imprint, policy_id, and nonce are set to `false`
|
9225
9625
|
#
|
9226
9626
|
class Request
|
9227
|
-
public
|
9228
|
-
|
9229
9627
|
# <!--
|
9230
9628
|
# rdoc-file=ext/openssl/ossl_ts.c
|
9231
9629
|
# - request.algorithm -> string
|
@@ -9368,8 +9766,6 @@ module OpenSSL
|
|
9368
9766
|
# Response.
|
9369
9767
|
#
|
9370
9768
|
class Response
|
9371
|
-
public
|
9372
|
-
|
9373
9769
|
# <!--
|
9374
9770
|
# rdoc-file=ext/openssl/ossl_ts.c
|
9375
9771
|
# - response.failure_info -> nil or symbol
|
@@ -9532,8 +9928,6 @@ module OpenSSL
|
|
9532
9928
|
# Response.
|
9533
9929
|
#
|
9534
9930
|
class TokenInfo
|
9535
|
-
public
|
9536
|
-
|
9537
9931
|
# <!--
|
9538
9932
|
# rdoc-file=ext/openssl/ossl_ts.c
|
9539
9933
|
# - token_info.algorithm -> string or nil
|
@@ -9902,8 +10296,6 @@ module OpenSSL
|
|
9902
10296
|
|
9903
10297
|
extend OpenSSL::Marshal::ClassMethods
|
9904
10298
|
|
9905
|
-
public
|
9906
|
-
|
9907
10299
|
# <!--
|
9908
10300
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
9909
10301
|
# - ==(other)
|
@@ -9974,8 +10366,6 @@ module OpenSSL
|
|
9974
10366
|
|
9975
10367
|
extend OpenSSL::Marshal::ClassMethods
|
9976
10368
|
|
9977
|
-
public
|
9978
|
-
|
9979
10369
|
# <!--
|
9980
10370
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
9981
10371
|
# - ==(other)
|
@@ -10252,8 +10642,6 @@ module OpenSSL
|
|
10252
10642
|
|
10253
10643
|
extend OpenSSL::Marshal::ClassMethods
|
10254
10644
|
|
10255
|
-
public
|
10256
|
-
|
10257
10645
|
# <!--
|
10258
10646
|
# rdoc-file=ext/openssl/ossl_x509cert.c
|
10259
10647
|
# - cert1 == cert2 -> true | false
|
@@ -10482,8 +10870,6 @@ module OpenSSL
|
|
10482
10870
|
|
10483
10871
|
extend OpenSSL::Marshal::ClassMethods
|
10484
10872
|
|
10485
|
-
public
|
10486
|
-
|
10487
10873
|
# <!--
|
10488
10874
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10489
10875
|
# - ==(other)
|
@@ -10595,8 +10981,6 @@ module OpenSSL
|
|
10595
10981
|
module AuthorityInfoAccess
|
10596
10982
|
include OpenSSL::X509::Extension::Helpers
|
10597
10983
|
|
10598
|
-
public
|
10599
|
-
|
10600
10984
|
# <!--
|
10601
10985
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10602
10986
|
# - ca_issuer_uris()
|
@@ -10633,8 +11017,6 @@ module OpenSSL
|
|
10633
11017
|
module AuthorityKeyIdentifier
|
10634
11018
|
include OpenSSL::X509::Extension::Helpers
|
10635
11019
|
|
10636
|
-
public
|
10637
|
-
|
10638
11020
|
# <!--
|
10639
11021
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10640
11022
|
# - authority_key_identifier()
|
@@ -10650,14 +11032,12 @@ module OpenSSL
|
|
10650
11032
|
module CRLDistributionPoints
|
10651
11033
|
include OpenSSL::X509::Extension::Helpers
|
10652
11034
|
|
10653
|
-
public
|
10654
|
-
|
10655
11035
|
# <!--
|
10656
11036
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10657
11037
|
# - crl_uris()
|
10658
11038
|
# -->
|
10659
11039
|
# Get the distributionPoint fullName URI from the certificate's CRL distribution
|
10660
|
-
# points extension, as described in
|
11040
|
+
# points extension, as described in RFC 5280 Section 4.2.1.13.
|
10661
11041
|
#
|
10662
11042
|
# Returns an array of strings or nil or raises ASN1::ASN1Error.
|
10663
11043
|
#
|
@@ -10665,8 +11045,6 @@ module OpenSSL
|
|
10665
11045
|
end
|
10666
11046
|
|
10667
11047
|
module Helpers
|
10668
|
-
public
|
10669
|
-
|
10670
11048
|
# <!--
|
10671
11049
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10672
11050
|
# - find_extension(oid)
|
@@ -10678,8 +11056,6 @@ module OpenSSL
|
|
10678
11056
|
module SubjectKeyIdentifier
|
10679
11057
|
include OpenSSL::X509::Extension::Helpers
|
10680
11058
|
|
10681
|
-
public
|
10682
|
-
|
10683
11059
|
# <!--
|
10684
11060
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
10685
11061
|
# - subject_key_identifier()
|
@@ -10697,8 +11073,6 @@ module OpenSSL
|
|
10697
11073
|
end
|
10698
11074
|
|
10699
11075
|
class ExtensionFactory
|
10700
|
-
public
|
10701
|
-
|
10702
11076
|
def config: () -> Config?
|
10703
11077
|
|
10704
11078
|
def config=: (Config config) -> Config
|
@@ -10828,7 +11202,6 @@ module OpenSSL
|
|
10828
11202
|
# `#to_s(OpenSSL::X509::Name::COMPAT)`. For example: `DC=com, DC=example,
|
10829
11203
|
# CN=nobody`
|
10830
11204
|
#
|
10831
|
-
#
|
10832
11205
|
# Neither of them is standardized and has quirks and inconsistencies in handling
|
10833
11206
|
# of escaped characters or multi-valued RDNs.
|
10834
11207
|
#
|
@@ -10848,8 +11221,6 @@ module OpenSSL
|
|
10848
11221
|
#
|
10849
11222
|
def self.parse_rfc2253: (String str, ?template template) -> instance
|
10850
11223
|
|
10851
|
-
public
|
10852
|
-
|
10853
11224
|
# <!-- rdoc-file=ext/openssl/ossl_x509name.c -->
|
10854
11225
|
# Compares this Name with *other* and returns `0` if they are the same and `-1`
|
10855
11226
|
# or `+1` if they are greater or less than each other respectively. Returns
|
@@ -10866,14 +11237,19 @@ module OpenSSL
|
|
10866
11237
|
#
|
10867
11238
|
# C
|
10868
11239
|
# : Country Name
|
11240
|
+
#
|
10869
11241
|
# CN
|
10870
11242
|
# : Common Name
|
11243
|
+
#
|
10871
11244
|
# DC
|
10872
11245
|
# : Domain Component
|
11246
|
+
#
|
10873
11247
|
# O
|
10874
11248
|
# : Organization Name
|
11249
|
+
#
|
10875
11250
|
# OU
|
10876
11251
|
# : Organizational Unit Name
|
11252
|
+
#
|
10877
11253
|
# ST
|
10878
11254
|
# : State or Province Name
|
10879
11255
|
#
|
@@ -10959,7 +11335,6 @@ module OpenSSL
|
|
10959
11335
|
# * OpenSSL::X509::Name::ONELINE
|
10960
11336
|
# * OpenSSL::X509::Name::MULTILINE
|
10961
11337
|
#
|
10962
|
-
#
|
10963
11338
|
# If *format* is omitted, the largely broken and traditional OpenSSL format
|
10964
11339
|
# (`X509_NAME_oneline()` format) is chosen.
|
10965
11340
|
#
|
@@ -11121,8 +11496,6 @@ module OpenSSL
|
|
11121
11496
|
|
11122
11497
|
extend OpenSSL::Marshal::ClassMethods
|
11123
11498
|
|
11124
|
-
public
|
11125
|
-
|
11126
11499
|
# <!--
|
11127
11500
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
11128
11501
|
# - ==(other)
|
@@ -11264,8 +11637,6 @@ module OpenSSL
|
|
11264
11637
|
end
|
11265
11638
|
|
11266
11639
|
class Revoked
|
11267
|
-
public
|
11268
|
-
|
11269
11640
|
# <!--
|
11270
11641
|
# rdoc-file=ext/openssl/lib/openssl/x509.rb
|
11271
11642
|
# - ==(other)
|
@@ -11385,8 +11756,6 @@ module OpenSSL
|
|
11385
11756
|
# ssl_socket = OpenSSL::SSL::SSLSocket.new tcp_socket, ssl_context
|
11386
11757
|
#
|
11387
11758
|
class Store
|
11388
|
-
public
|
11389
|
-
|
11390
11759
|
# <!--
|
11391
11760
|
# rdoc-file=ext/openssl/ossl_x509store.c
|
11392
11761
|
# - store.add_cert(cert) -> self
|
@@ -11485,7 +11854,6 @@ module OpenSSL
|
|
11485
11854
|
# * X509::PURPOSE_OCSP_HELPER
|
11486
11855
|
# * X509::PURPOSE_TIMESTAMP_SIGN
|
11487
11856
|
#
|
11488
|
-
#
|
11489
11857
|
# OpenSSL::X509::StoreContext#purpose= can be used to change the value for a
|
11490
11858
|
# single verification operation.
|
11491
11859
|
#
|
@@ -11504,7 +11872,6 @@ module OpenSSL
|
|
11504
11872
|
# * OpenSSL::X509::DEFAULT_CERT_FILE
|
11505
11873
|
# * OpenSSL::X509::DEFAULT_CERT_DIR
|
11506
11874
|
#
|
11507
|
-
#
|
11508
11875
|
# See also the man page X509_STORE_set_default_paths(3).
|
11509
11876
|
#
|
11510
11877
|
def set_default_paths: () -> nil
|
@@ -11595,8 +11962,6 @@ module OpenSSL
|
|
11595
11962
|
# status involved.
|
11596
11963
|
#
|
11597
11964
|
class StoreContext
|
11598
|
-
public
|
11599
|
-
|
11600
11965
|
# <!--
|
11601
11966
|
# rdoc-file=ext/openssl/ossl_x509store.c
|
11602
11967
|
# - stctx.chain -> nil | Array of X509::Certificate
|