diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/e2e.rb | 3 | ||||
| -rw-r--r-- | lib/e2e/x509.rb | 13 |
2 files changed, 15 insertions, 1 deletions
@@ -1,4 +1,5 @@ -require 'json' require 'e2e/dependency_scanning_report' require 'e2e/docker' require 'e2e/project' +require 'e2e/x509' +require 'json' diff --git a/lib/e2e/x509.rb b/lib/e2e/x509.rb new file mode 100644 index 0000000..898ecc1 --- /dev/null +++ b/lib/e2e/x509.rb @@ -0,0 +1,13 @@ +class X509 + def self.self_signed(key: OpenSSL::PKey::RSA.new(4096)) + certificate = OpenSSL::X509::Certificate.new + certificate.subject = certificate.issuer = OpenSSL::X509::Name.parse("/C=/ST=/L=/O=/OU=/CN=") + certificate.not_before = Time.now.to_i + certificate.not_after = Time.now.to_i + 600 + certificate.public_key = key.public_key + certificate.serial = 0x01 + certificate.version = 2 + certificate.sign(key, OpenSSL::Digest::SHA256.new) + certificate + end +end |
