lib/localhost/authority.rb in localhost-1.1.9 vs lib/localhost/authority.rb in localhost-1.1.10
- old
+ new
@@ -1,26 +1,15 @@
-# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
+# frozen_string_literal: true
-require 'yaml'
+# Released under the MIT License.
+# Copyright, 2018-2023, by Samuel Williams.
+# Copyright, 2019, by Richard S. Leung.
+# Copyright, 2021, by Akshay Birajdar.
+# Copyright, 2021, by Ye Lin Aung.
+# Copyright, 2023, by Antonio Terceiro.
+# Copyright, 2023, by Yuuji Yaginuma.
+
require 'openssl'
module Localhost
# Represents a single public/private key pair for a given hostname.
class Authority
@@ -117,10 +106,10 @@
# We use the same issuer as the subject, which makes this certificate self-signed:
certificate.issuer = self.name
certificate.public_key = self.key.public_key
- certificate.serial = 1
+ certificate.serial = Time.now.to_i
certificate.version = 2
certificate.not_before = Time.now
certificate.not_after = Time.now + (3600 * 24 * 365 * 10)