STIX

 view release on metacpan or  search on metacpan

lib/STIX/Observable/Type/X509V3Extensions.pm  view on Meta::CPAN

use namespace::autoclean;

extends 'STIX::Object';

use constant SCHEMA =>
    'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/x509-certificate.json#/definitions/x509-v3-extensions-type';

use constant PROPERTIES => (qw(
    basic_constraints name_constraints policy_constraints key_usage extended_key_usage subject_key_identifier
    authority_key_identifier subject_alternative_name issuer_alternative_name subject_directory_attributes
    crl_distribution_points inhibit_any_policy private_key_usage_period_not_before
    private_key_usage_period_not_after certificate_policies policy_mappings
));

has basic_constraints            => (is => 'rw', isa => Str);
has name_constraints             => (is => 'rw', isa => Str);
has policy_constraints           => (is => 'rw', isa => Str);
has key_usage                    => (is => 'rw', isa => Str);
has extended_key_usage           => (is => 'rw', isa => Str);
has subject_key_identifier       => (is => 'rw', isa => Str);
has authority_key_identifier     => (is => 'rw', isa => Str);
has subject_alternative_name     => (is => 'rw', isa => Str);
has issuer_alternative_name      => (is => 'rw', isa => Str);
has subject_directory_attributes => (is => 'rw', isa => Str);
has crl_distribution_points      => (is => 'rw', isa => Str);
has inhibit_any_policy           => (is => 'rw', isa => Str);

has private_key_usage_period_not_before => (
    is     => 'rw',
    isa    => InstanceOf ['STIX::Common::Timestamp'],
    coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
);

has private_key_usage_period_not_after => (
    is     => 'rw',
    isa    => InstanceOf ['STIX::Common::Timestamp'],
    coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
);

has certificate_policies => (is => 'rw', isa => Str);
has policy_mappings      => (is => 'rw', isa => Str);

1;

lib/STIX/Observable/Type/X509V3Extensions.pm  view on Meta::CPAN

=item $x509_v3_extensions_type->policy_constraints

Specifies any constraints on path validation for certificates issued to
CAs.

=item $x509_v3_extensions_type->policy_mappings

Specifies one or more pairs of OIDs; each pair includes an
issuerDomainPolicy and a subjectDomainPolicy

=item $x509_v3_extensions_type->private_key_usage_period_not_after

Specifies the date on which the validity period ends for the private key,
if it is different from the validity period of the certificate.

=item $x509_v3_extensions_type->private_key_usage_period_not_before

Specifies the date on which the validity period begins for the private key,
if it is different from the validity period of the certificate.

=item $x509_v3_extensions_type->subject_alternative_name

Specifies the additional identities to be bound to the subject of the
certificate.

=item $x509_v3_extensions_type->subject_directory_attributes

lib/STIX/cache/d8975888f86eddd6a974121f047eab85  view on Meta::CPAN

              "description": "Specifies the identification attributes (e.g., nationality) of the subject."
            },
            "crl_distribution_points": {
              "type": "string",
              "description": "Specifies how CRL information is obtained."
            },
            "inhibit_any_policy": {
              "type": "string",
              "description": "Specifies the number of additional certificates that may appear in the path before anyPolicy is no longer permitted."
            },
            "private_key_usage_period_not_before": {
              "$ref": "../common/timestamp.json",
              "description": "Specifies the date on which the validity period begins for the private key, if it is different from the validity period of the certificate."
            },
            "private_key_usage_period_not_after": {
              "$ref": "../common/timestamp.json",
              "description": "Specifies the date on which the validity period ends for the private key, if it is different from the validity period of the certificate."
            },
            "certificate_policies": {
              "type": "string",
              "description": "Specifies a sequence of one or more policy information terms, each of which consists of an object identifier (OID) and optional qualifiers."
            },
            "policy_mappings": {
              "type": "string",
              "description": "Specifies one or more pairs of OIDs; each pair includes an issuerDomainPolicy and a subjectDomainPolicy"

lib/STIX/cache/d8975888f86eddd6a974121f047eab85  view on Meta::CPAN

            { "required": ["policy_constraints"] },
            { "required": ["key_usage"] },
            { "required": ["extended_key_usage"] },
            { "required": ["subject_key_identifier"] },
            { "required": ["authority_key_identifier"] },
            { "required": ["subject_alternative_name"] },
            { "required": ["issuer_alternative_name"] },
            { "required": ["subject_directory_attributes"] },
            { "required": ["crl_distribution_points"] },
            { "required": ["inhibit_any_policy"] },
            { "required": ["private_key_usage_period_not_before"] },
            { "required": ["private_key_usage_period_not_after"] },
            { "required": ["certificate_policies"] },
            { "required": ["policy_mappings"] }
          ]
        }
      ]
    }
  }
}

t/50-observables-x509-certificate-2.t  view on Meta::CPAN

        name_constraints                    => 'permitted;IP:192.168.0.0/255.255.0.0',
        policy_contraints                   => 'requireExplicitPolicy:3',
        key_usage                           => 'critical, keyCertSign',
        extended_key_usage                  => 'critical,codeSigning,1.2.3.4',
        subject_key_identifier              => 'hash',
        authority_key_identifier            => 'keyid,issuer',
        subject_alternative_name            => 'email:my@other.address,RID:1.2.3.4',
        issuer_alternative_name             => 'issuer:copy',
        crl_distribution_points             => 'URI:http://myhost.com/myca.crl',
        inhibit_any_policy                  => '2',
        private_key_usage_period_not_before => '2016-03-12T12:00',
        private_key_usage_period_not_after  => '2018-03-12T12:00',
        certificate_policies                => '1.2.4.5, 1.1.3.'
    )
);

my @errors = $object->validate;

diag 'X.509 Certificate w/ V3 Extensions', "\n", "$object";

isnt "$object", '';

t/examples-bundle.json  view on Meta::CPAN

      "name_constraints": "permitted;IP:192.168.0.0/255.255.0.0",
      "policy_constraints": "requireExplicitPolicy:3",
      "key_usage": "critical, keyCertSign",
      "extended_key_usage": "critical,codeSigning,1.2.3.4",
      "subject_key_identifier": "hash",
      "authority_key_identifier": "keyid,issuer",
      "subject_alternative_name": "email:my@other.address,RID:1.2.3.4",
      "issuer_alternative_name": "issuer:copy",
      "crl_distribution_points": "URI:http://myhost.com/myca.crl",
      "inhibit_any_policy": "2",
      "private_key_usage_period_not_before": "2016-03-12T12:00:00Z",
      "private_key_usage_period_not_after": "2018-03-12T12:00:00Z",
      "certificate_policies": "1.2.4.5, 1.1.3.4"
    }
  },

  {
    "type": "attack-pattern",
    "spec_version": "2.1",
    "id": "attack-pattern--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061",
    "created": "2016-05-12T08:17:27.000Z",
    "modified": "2016-05-12T08:17:27.000Z",



( run in 0.622 second using v1.01-cache-2.11-cpan-a5abf4f5562 )