File: ca_config.rb

package info (click to toggle)
jruby 1.7.26-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,572 kB
  • sloc: ruby: 669,910; java: 253,056; xml: 35,152; ansic: 9,187; yacc: 7,267; cpp: 5,244; sh: 1,036; makefile: 345; jsp: 48; tcl: 40
file content (37 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download
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
class CAConfig
  BASE_DIR = File.dirname(__FILE__)
  KEYPAIR_FILE = "#{BASE_DIR}/private/cakeypair.pem"
  CERT_FILE = "#{BASE_DIR}/cacert.pem"
  SERIAL_FILE = "#{BASE_DIR}/serial"
  NEW_CERTS_DIR = "#{BASE_DIR}/newcerts"
  NEW_KEYPAIR_DIR = "#{BASE_DIR}/private/keypair_backup"
  CRL_DIR = "#{BASE_DIR}/crl"

  NAME = [['C', 'JP'], ['O', 'www.ruby-lang.org'], ['OU', 'development']]
  CA_CERT_DAYS = 20 * 365
  CA_RSA_KEY_LENGTH = 2048

  CERT_DAYS = 18 * 365
  CERT_KEY_LENGTH_MIN = 1024
  CERT_KEY_LENGTH_MAX = 2048
  CDP_LOCATION = nil
  OCSP_LOCATION = nil

  CRL_FILE = "#{CRL_DIR}/jruby.crl"
  CRL_PEM_FILE = "#{CRL_DIR}/jruby.pem"
  CRL_DAYS = 14

  PASSWD_CB = Proc.new { |flag|
    print "Enter password: "
    pass = $stdin.gets.chop!
    # when the flag is true, this passphrase
    # will be used to perform encryption; otherwise it will
    # be used to perform decryption.
    if flag
      print "Verify password: "
      pass2 = $stdin.gets.chop!
      raise "verify failed." if pass != pass2
    end
    pass
  }
end