File: base.rb

package info (click to toggle)
ruby-ssh-data 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 188 kB
  • sloc: ruby: 1,488; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module SSHData
  module PrivateKey
    class Base
      attr_reader :algo, :comment, :public_key

      def initialize(**kwargs)
        @algo = kwargs[:algo]
        @comment = kwargs[:comment]
      end

      # Generate a new private key.
      #
      # Returns a PublicKey::Base subclass instance.
      def self.generate(**kwargs)
        raise "implement me"
      end

      # Make an SSH signature.
      #
      # signed_data - The String message over which to calculated the signature.
      # algo:       - Optionally specify the signature algorithm to use.
      #
      # Returns a binary String signature.
      def sign(signed_data, algo: nil)
        raise "implement me"
      end

      # Issue a certificate using this private key.
      #
      # signature_algo: - Optionally specify the signature algorithm to use.
      # kwargs          - See SSHData::Certificate.new.
      #
      # Returns a SSHData::Certificate instance.
      def issue_certificate(signature_algo: nil, **kwargs)
        Certificate.new(**kwargs).tap { |c| c.sign(self, algo: signature_algo) }
      end
    end
  end
end