pfSense-pkg-RESTAPI

X509Validator extends Validator
in package

Defines a Validator that determines if a given string is an X509 encoded object.

Table of Contents

Constants

CRT_BEGIN  = 'BEGIN CERTIFICATE'
CRT_END  = 'BEGIN CERTIFICATE'
CSR_BEGIN  = 'BEGIN CERTIFICATE REQUEST'
CSR_BEGIN_NEW  = 'BEGIN NEW CERTIFICATE REQUEST'
CSR_END  = 'END CERTIFICATE REQUEST'
CSR_END_NEW  = 'END NEW CERTIFICATE REQUEST'
ECPRV_BEGIN  = 'BEGIN EC PRIVATE KEY'
ECPRV_END  = 'END EC PRIVATE KEY'
PRV_BEGIN  = 'BEGIN PRIVATE KEY'
PRV_END  = 'END PRIVATE KEY'
RSA_BEGIN  = 'BEGIN RSA PRIVATE KEY'
RSA_END  = 'END RSA PRIVATE KEY'

Properties

$allow_crt  : bool
$allow_csr  : bool
$allow_ecprv  : bool
$allow_prv  : bool
$allow_rsa  : bool
$field_context  : Field|null
$model_context  : Model|null

Methods

__construct()  : mixed
Constructs the X509Validator object.
get_class_fqn()  : string
Obtains the fully qualified name of the called class.
get_class_shortname()  : string
Obtains the shortname of the called class.
get_classes_in_namespace()  : array<string|int, mixed>
Obtains all classes associated with this class's current namespace.
is_matching_keypair()  : bool
Checks if a given public key and private key are matching key pairs.
log_error()  : void
Logs an error to the syslog.
validate()  : void
Checks if a given value is a valid X509 string.
set_label()  : mixed
Sets a label on the assigned $field_context if present.
get_options_str()  : string
Uses the `allow_*` properties to format a string of value options this validator will accept.

Constants

CSR_BEGIN

public mixed CSR_BEGIN = 'BEGIN CERTIFICATE REQUEST'

CSR_BEGIN_NEW

public mixed CSR_BEGIN_NEW = 'BEGIN NEW CERTIFICATE REQUEST'

CSR_END_NEW

public mixed CSR_END_NEW = 'END NEW CERTIFICATE REQUEST'

ECPRV_BEGIN

public mixed ECPRV_BEGIN = 'BEGIN EC PRIVATE KEY'

Properties

$field_context

public Field|null $field_context = null

The parent Model Field object that called this Validator.

$model_context

public Model|null $model_context = null

The parent Model object that called this Validator.

Methods

__construct()

Constructs the X509Validator object.

public __construct([bool $allow_crt = true ][, bool $allow_csr = false ][, bool $allow_prv = false ][, bool $allow_rsa = false ][, bool $allow_ecprv = false ]) : mixed
Parameters
$allow_crt : bool = true

Set to true to consider X509 Certificate strings to be valid.

$allow_csr : bool = false

Set to true to consider X509 Certificate Signing Request strings to be valid.

$allow_prv : bool = false

Set to true to consider X509 Private Key strings to be valid.

$allow_rsa : bool = false

Set to true to consider X509 RSA Private Key strings to be valid.

$allow_ecprv : bool = false

Set to true to consider X509 EC Private Key strings to be valid.

get_class_fqn()

Obtains the fully qualified name of the called class.

public get_class_fqn() : string
Return values
string

The FQN for this object's class.

get_class_shortname()

Obtains the shortname of the called class.

public get_class_shortname() : string
Return values
string

The shortname for this object's class.

get_classes_in_namespace()

Obtains all classes associated with this class's current namespace.

public get_classes_in_namespace([bool $shortnames = false ]) : array<string|int, mixed>
Parameters
$shortnames : bool = false
Return values
array<string|int, mixed>

An array of classes currently in this object's namespace

is_matching_keypair()

Checks if a given public key and private key are matching key pairs.

public static is_matching_keypair(string $public_key, string $private_key) : bool
Parameters
$public_key : string

The x509 public key to evaluate.

$private_key : string

the x509 private key to evaluate

Tags
returns

bool true if the public key and private key are matching key pairs.

Return values
bool

log_error()

Logs an error to the syslog.

public static log_error(string $message) : void
Parameters
$message : string

The error message to write to the syslog

validate()

Checks if a given value is a valid X509 string.

public validate(mixed $value[, string $field_name = '' ]) : void
Parameters
$value : mixed

The incoming value to be validated.

$field_name : string = ''

The name of the field being validated.

Tags
throws
ValidationError

When the $value is not a valid X509 string.

set_label()

Sets a label on the assigned $field_context if present.

protected set_label(string $label_name) : mixed
Parameters
$label_name : string

The label to assign to the Field context object

get_options_str()

Uses the `allow_*` properties to format a string of value options this validator will accept.

private get_options_str() : string
Return values
string

        
On this page

Search results