amazon-archives / certlint

X.509 certificate linter
Apache License 2.0
157 stars 42 forks source link

cablint-ct shows error #37

Closed kmat32 closed 7 years ago

kmat32 commented 8 years ago

Issue: Command for cablint and certlint is working but for cablint-ct I am getting following error.

Actual command ruby -I /certlint-master/lib /certlint-master/bin/cablint-ct "lex.der"

Actual error:

/certlint-master/lib/certlint/ct.rb:149:in `initialize': undefined method `+' for nil:NilClass (NoMethodError)
from /certlint-master/bin/cablint-ct:39:in `new'
from /certlint-master/bin/cablint-ct:39:in `<main>'

Background information: Successfully built certlint-x509helper executable and placed the file in /usr/bin/ System Environment: Fedora 24 64 bit "SSL.der" is standard x509 binary der file.

Many Thanks in advanced.

kmat32 commented 8 years ago

It seems like it is not accepting the plus (+) sign in /certlint-master/lib/certlint/ct.rb:149:in `initialize. Code in /certlint-master/lib/certlint/ct.rb does provide a plus (+) sign but not sure how to override the error thou.

def initialize(tbs_der)
        asn = OpenSSL::ASN1.decode(tbs_der)
        # tbsCertificate.version is optional, so we don't have a fixed
        # offset. Check if the first item is a pure ASN1Data, which
        # is a strong hint that it is an EXPLICIT wrapper for the first
        # element in the struct.  If so, this is the version, so everything
        # is offset by one.
        skip = asn.value[0].instance_of?(OpenSSL::ASN1::ASN1Data) ? 1 : 0
        sig_alg_der = asn.value[1 + skip].to_der
        @raw = OpenSSL::ASN1::Sequence.new([tbs_der, sig_alg_der, DER_SIG]).to_der
        super(@raw)
      end
    end
pzb commented 7 years ago

cablint-ct does not take a certificate file name, rather it downloads the certificate from a known CT log. You probably want to run cablint instead.