ASN1: move ASN1 maps to external files for reuse

This commit is contained in:
terrafrost 2016-11-17 09:57:29 -06:00
parent 272ae9c64c
commit df6d55fd97
105 changed files with 3965 additions and 1263 deletions

View File

@ -1,8 +1,10 @@
language: php
php:
- 5.6
- 7.0
- 7.1
- hhvm
env:
global:

View File

@ -39,138 +39,6 @@ use phpseclib\Math\BigInteger;
use phpseclib\File\ASN1;
use phpseclib\Exception\UnsupportedAlgorithmException;
// version is the syntax version number, for compatibility with
// future revisions of this document. It shall be 0 for this version
// of the document.
define(__NAMESPACE__ . '\Version', [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1']
]);
// we can replace this later once the X509 definitions are rewritten
define(__NAMESPACE__ . '\AlgorithmIdentifier', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'parameters' => [
'type' => ASN1::TYPE_ANY,
'optional' => true
]
]
]);
define(__NAMESPACE__ . '\PrivateKey', ['type' => ASN1::TYPE_OCTET_STRING]);
// we can replace this later once the X509 definitions are rewritten
define(__NAMESPACE__ . '\AttributeType', ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]);
// we can replace this later once the X509 definitions are rewritten
define(__NAMESPACE__ . '\AttributeValue', ['type' => ASN1::TYPE_ANY]);
// we can replace this later once the X509 definitions are rewritten
define(__NAMESPACE__ . '\Attribute', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => AttributeType,
'value'=> [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => -1,
'children' => AttributeValue
]
]
]);
define(__NAMESPACE__ . '\Attributes', [
'type' => ASN1::TYPE_SET,
'children' => Attribute
]);
define(__NAMESPACE__ . '\PrivateKeyInfo', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => Version,
'privateKeyAlgorithm'=> AlgorithmIdentifier,
'privateKey' => PrivateKey,
'attributes' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + Attributes
]
]);
define(__NAMESPACE__ . '\EncryptedData', ['type' => ASN1::TYPE_OCTET_STRING]);
define(__NAMESPACE__ . '\EncryptedPrivateKeyInfo', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'encryptionAlgorithm' => AlgorithmIdentifier,
'encryptedData' => EncryptedData
]
]);
// this format is not formally defined anywhere but is none-the-less the form you
// get when you do "openssl rsa -in private.pem -outform PEM -pubout"
define(__NAMESPACE__ . '\PublicKeyInfo', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'publicKeyAlgorithm'=> AlgorithmIdentifier,
'publicKey' => ['type' => ASN1::TYPE_BIT_STRING]
]
]);
// from https://tools.ietf.org/html/rfc2898#appendix-A.3
define(__NAMESPACE__ . '\PBEParameter', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'salt' => ['type' => ASN1::TYPE_OCTET_STRING],
'iterationCount' => ['type' => ASN1::TYPE_INTEGER]
]
]);
define(__NAMESPACE__ . '\PBES2params', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'keyDerivationFunc'=> AlgorithmIdentifier,
'encryptionScheme' => AlgorithmIdentifier
]
]);
define(__NAMESPACE__ . '\PBMAC1params', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'keyDerivationFunc'=> AlgorithmIdentifier,
'messageAuthScheme'=> AlgorithmIdentifier
]
]);
define(__NAMESPACE__ . '\RC2CBCParameter', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'rc2ParametersVersion'=> [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
],
'iv'=> ['type' => ASN1::TYPE_OCTET_STRING]
]
]);
define(__NAMESPACE__ . '\PBKDF2params', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
// technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder
// in the RFC
'salt'=> ['type' => ASN1::TYPE_OCTET_STRING],
'iterationCount'=> ['type' => ASN1::TYPE_INTEGER],
'keyLength' => [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
],
'prf' => AlgorithmIdentifier + ['optional' => true]
]
]);
// from https://tools.ietf.org/html/rfc2898
define(__NAMESPACE__ . '\oids', [
// PBES1 encryption schemes
@ -455,7 +323,7 @@ class PKCS8 extends PKCS
$meta = [];
$asn1->loadOIDs(oids);
$decrypted = $asn1->asn1map($decoded[0], EncryptedPrivateKeyInfo);
$decrypted = $asn1->asn1map($decoded[0], ASN1\EncryptedPrivateKeyInfo::MAP);
if (strlen($password) && is_array($decrypted)) {
$algorithm = $decrypted['encryptionAlgorithm']['algorithm'];
switch ($algorithm) {
@ -479,7 +347,7 @@ class PKCS8 extends PKCS
$meta['meta']['algorithm'] = $algorithm;
$temp = $asn1->decodeBER($decrypted['encryptionAlgorithm']['parameters']);
extract($asn1->asn1map($temp[0], PBEParameter));
extract($asn1->asn1map($temp[0], ASN1\PBEParameter::MAP));
$iterationCount = (int) $iterationCount->toString();
$cipher->setPassword($password, $kdf, $hash, Base64::decode($salt), $iterationCount);
$key = $cipher->decrypt(Base64::decode($decrypted['encryptedData']));
@ -493,21 +361,21 @@ class PKCS8 extends PKCS
$meta['meta']['algorithm'] = $algorithm;
$temp = $asn1->decodeBER($decrypted['encryptionAlgorithm']['parameters']);
$temp = $asn1->asn1map($temp[0], PBES2params);
$temp = $asn1->asn1map($temp[0], ASN1\PBES2params::MAP);
extract($temp);
$cipher = self::getPBES2EncryptionObject($encryptionScheme['algorithm']);
$meta['meta']['cipher'] = $encryptionScheme['algorithm'];
$temp = $asn1->decodeBER($decrypted['encryptionAlgorithm']['parameters']);
$temp = $asn1->asn1map($temp[0], PBES2params);
$temp = $asn1->asn1map($temp[0], ASN1\PBES2params::MAP);
extract($temp);
if (!$cipher instanceof RC2) {
$cipher->setIV(Base64::decode($encryptionScheme['parameters']['octetString']));
} else {
$temp = $asn1->decodeBER($encryptionScheme['parameters']);
extract($asn1->asn1map($temp[0], RC2CBCParameter));
extract($asn1->asn1map($temp[0], ASN1\RC2CBCParameter::MAP));
$effectiveKeyLength = (int) $rc2ParametersVersion->toString();
switch ($effectiveKeyLength) {
case 160:
@ -530,7 +398,7 @@ class PKCS8 extends PKCS
case 'id-PBKDF2':
$temp = $asn1->decodeBER($keyDerivationFunc['parameters']);
$prf = ['algorithm' => 'id-hmacWithSHA1'];
$params = $asn1->asn1map($temp[0], PBKDF2params);
$params = $asn1->asn1map($temp[0], ASN1\PBKDF2params::MAP);
extract($params);
$meta['meta']['prf'] = $prf['algorithm'];
$hash = str_replace('-', '/', substr($prf['algorithm'], 11));
@ -557,14 +425,14 @@ class PKCS8 extends PKCS
break;
case 'id-PBMAC1':
//$temp = $asn1->decodeBER($decrypted['encryptionAlgorithm']['parameters']);
//$value = $asn1->asn1map($temp[0], PBMAC1params);
//$value = $asn1->asn1map($temp[0], ASN1\PBMAC1params::MAP);
// since i can't find any implementation that does PBMAC1 it is unsupported
throw new UnsupportedAlgorithmException('Only PBES1 and PBES2 PKCS#8 keys are supported.');
// at this point we'll assume that the key conforms to PublicKeyInfo
}
}
$private = $asn1->asn1map($decoded[0], PrivateKeyInfo);
$private = $asn1->asn1map($decoded[0], ASN1\PrivateKeyInfo::MAP);
if (is_array($private)) {
return $private + $meta;
}
@ -573,7 +441,7 @@ class PKCS8 extends PKCS
// is that the former has an octet string and the later has a bit string. the first byte of a bit
// string represents the number of bits in the last byte that are to be ignored but, currently,
// bit strings wanting a non-zero amount of bits trimmed are not supported
$public = $asn1->asn1map($decoded[0], PublicKeyInfo);
$public = $asn1->asn1map($decoded[0], ASN1\PublicKeyInfo::MAP);
if (is_array($public)) {
$public['publicKey'] = base64_decode($public['publicKey']);
if ($public['publicKey'][0] != "\0") {
@ -609,7 +477,7 @@ class PKCS8 extends PKCS
if (!empty($attr)) {
$key['attributes'] = $attr;
}
$key = $asn1->encodeDER($key, PrivateKeyInfo);
$key = $asn1->encodeDER($key, ASN1\PrivateKeyInfo::MAP);
if (!empty($password) && is_string($password)) {
$salt = Random::string(8);
$iterationCount = self::$defaultIterationCount;
@ -625,7 +493,7 @@ class PKCS8 extends PKCS
'iterationCount' => $iterationCount,
'prf' => ['algorithm' => self::$defaultPRF, 'parameters' => null]
];
$PBKDF2params = $asn1->encodeDER($PBKDF2params, PBKDF2params);
$PBKDF2params = $asn1->encodeDER($PBKDF2params, ASN1\PBKDF2params::MAP);
if (!$crypto instanceof RC2) {
$params = ['octetString' => Base64::encode($iv)];
@ -634,7 +502,7 @@ class PKCS8 extends PKCS
'rc2ParametersVersion' => 58,
'iv' => Base64::encode($iv)
];
$params = $asn1->encodeDER($params, RC2CBCParameter);
$params = $asn1->encodeDER($params, ASN1\RC2CBCParameter::MAP);
$params = new ASN1\Element($params);
}
@ -648,7 +516,7 @@ class PKCS8 extends PKCS
'parameters' => $params
]
];
$params = $asn1->encodeDER($params, PBES2params);
$params = $asn1->encodeDER($params, ASN1\PBES2params::MAP);
$crypto->setIV($iv);
} else {
@ -660,7 +528,7 @@ class PKCS8 extends PKCS
'salt' => Base64::encode($salt),
'iterationCount' => $iterationCount
];
$params = $asn1->encodeDER($params, PBEParameter);
$params = $asn1->encodeDER($params, ASN1\PBEParameter::MAP);
}
$crypto->setPassword($password, $kdf, $hash, $salt, $iterationCount);
$key = $crypto->encrypt($key);
@ -673,7 +541,7 @@ class PKCS8 extends PKCS
'encryptedData' => Base64::encode($key)
];
$key = $asn1->encodeDER($key, EncryptedPrivateKeyInfo);
$key = $asn1->encodeDER($key, ASN1\EncryptedPrivateKeyInfo::MAP);
return "-----BEGIN ENCRYPTED PRIVATE KEY-----\r\n" .
chunk_split(Base64::encode($key), 64) .
@ -704,7 +572,7 @@ class PKCS8 extends PKCS
'publicKey' => Base64::encode("\0" . $key)
];
$key = $asn1->encodeDER($key, PublicKeyInfo);
$key = $asn1->encodeDER($key, ASN1\PublicKeyInfo::MAP);
return "-----BEGIN PUBLIC KEY-----\r\n" .
chunk_split(Base64::encode($key), 64) .

View File

@ -28,52 +28,6 @@ use phpseclib\Math\BigInteger;
use phpseclib\Crypt\Common\PKCS1 as Progenitor;
use phpseclib\File\ASN1;
// version must be multi if otherPrimeInfos present
define(__NAMESPACE__ . '\Version', [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['two-prime', 'multi']
]);
define(__NAMESPACE__ . '\OtherPrimeInfo', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'prime' => ['type' => ASN1::TYPE_INTEGER], // ri
'exponent' => ['type' => ASN1::TYPE_INTEGER], // di
'coefficient' => ['type' => ASN1::TYPE_INTEGER] // ti
]
]);
define(__NAMESPACE__ . '\OtherPrimeInfos', [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => OtherPrimeInfo
]);
define(__NAMESPACE__ . '\RSAPrivateKey', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => Version,
'modulus' => ['type' => ASN1::TYPE_INTEGER], // n
'publicExponent' => ['type' => ASN1::TYPE_INTEGER], // e
'privateExponent' => ['type' => ASN1::TYPE_INTEGER], // d
'prime1' => ['type' => ASN1::TYPE_INTEGER], // p
'prime2' => ['type' => ASN1::TYPE_INTEGER], // q
'exponent1' => ['type' => ASN1::TYPE_INTEGER], // d mod (p-1)
'exponent2' => ['type' => ASN1::TYPE_INTEGER], // d mod (q-1)
'coefficient' => ['type' => ASN1::TYPE_INTEGER], // (inverse of q) mod p
'otherPrimeInfos' => OtherPrimeInfos + ['optional' => true]
]
]);
define(__NAMESPACE__ . '\RSAPublicKey', [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'modulus' => ['type' => ASN1::TYPE_INTEGER],
'publicExponent' => ['type' => ASN1::TYPE_INTEGER]
]
]);
/**
* PKCS#1 Formatted RSA Key Handler
*
@ -110,7 +64,7 @@ class PKCS1 extends Progenitor
return false;
}
$key = $asn1->asn1map($decoded[0], RSAPrivateKey);
$key = $asn1->asn1map($decoded[0], ASN1\RSAPrivateKey::MAP);
if (is_array($key)) {
$components+= [
'modulus' => $key['modulus'],
@ -130,7 +84,7 @@ class PKCS1 extends Progenitor
return $components;
}
$key = $asn1->asn1map($decoded[0], RSAPublicKey);
$key = $asn1->asn1map($decoded[0], ASN1\RSAPublicKey::MAP);
return is_array($key) ? $components + $key : false;
}
@ -171,7 +125,7 @@ class PKCS1 extends Progenitor
}
$asn1 = new ASN1();
$key = $asn1->encodeDER($key, RSAPrivateKey);
$key = $asn1->encodeDER($key, ASN1\RSAPrivateKey::MAP);
return self::wrapPrivateKey($key, 'RSA', $password);
}
@ -192,7 +146,7 @@ class PKCS1 extends Progenitor
];
$asn1 = new ASN1();
$key = $asn1->encodeDER($key, RSAPublicKey);
$key = $asn1->encodeDER($key, ASN1\RSAPublicKey::MAP);
return self::wrapPublicKey($key, 'RSA');
}

View File

@ -616,7 +616,14 @@ class ASN1
$map[$key] = $candidate;
$i++;
} elseif (isset($child['default'])) {
$map[$key] = $child['default']; // Use default.
switch ($child['type']) {
case ASN1::TYPE_INTEGER:
$map[$key] = new BigInteger($child['default']);
break;
//case ASN1::TYPE_BOOLEAN:
default:
$map[$key] = $child['type'];
}
} elseif (!isset($child['optional'])) {
return null; // Syntax error.
}

View File

@ -0,0 +1,36 @@
<?php
/**
* AccessDescription
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AccessDescription
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AccessDescription
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'accessLocation' => GeneralName::MAP
]
];
}

View File

@ -0,0 +1,40 @@
<?php
/**
* AdministrationDomainName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AdministrationDomainName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AdministrationDomainName
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
// if class isn't present it's assumed to be \phpseclib\File\ASN1::CLASS_UNIVERSAL or
// (if constant is present) \phpseclib\File\ASN1::CLASS_CONTEXT_SPECIFIC
'class' => ASN1::CLASS_APPLICATION,
'cast' => 2,
'children' => [
'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING],
'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING]
]
];
}

View File

@ -0,0 +1,39 @@
<?php
/**
* AlgorithmIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AlgorithmIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AlgorithmIdentifier
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'parameters' => [
'type' => ASN1::TYPE_ANY,
'optional' => true
]
]
];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* AnotherName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AnotherName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AnotherName
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type-id' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'value' => [
'type' => ASN1::TYPE_ANY,
'constant' => 0,
'optional' => true,
'explicit' => true
]
]
];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* Attribute
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Attribute
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Attribute
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => AttributeType::MAP,
'value'=> [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => -1,
'children' => AttributeValue::MAP
]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* AttributeType
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AttributeType
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AttributeType
{
const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* AttributeTypeAndValue
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AttributeTypeAndValue
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AttributeTypeAndValue
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => AttributeType::MAP,
'value'=> AttributeValue::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* AttributeValue
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AttributeValue
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AttributeValue
{
const MAP = ['type' => ASN1::TYPE_ANY];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* Attributes
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Attributes
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Attributes
{
const MAP = [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => -1,
'children' => Attribute::MAP
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* AuthorityInfoAccessSyntax
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AuthorityInfoAccessSyntax
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AuthorityInfoAccessSyntax
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => AccessDescription::MAP
];
}

View File

@ -0,0 +1,49 @@
<?php
/**
* AuthorityKeyIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* AuthorityKeyIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class AuthorityKeyIdentifier
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'keyIdentifier' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + KeyIdentifier::MAP,
'authorityCertIssuer' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + GeneralNames::MAP,
'authorityCertSerialNumber' => [
'constant' => 2,
'optional' => true,
'implicit' => true
] + CertificateSerialNumber::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* BaseDistance
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* BaseDistance
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class BaseDistance
{
const MAP = ['type' => ASN1::TYPE_INTEGER];
}

View File

@ -0,0 +1,43 @@
<?php
/**
* BasicConstraints
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* BasicConstraints
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class BasicConstraints
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'cA' => [
'type' => ASN1::TYPE_BOOLEAN,
'optional' => true,
'default' => false
],
'pathLenConstraint' => [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
]
]
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* BuiltInDomainDefinedAttribute
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* BuiltInDomainDefinedAttribute
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class BuiltInDomainDefinedAttribute
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
'value' => ['type' => ASN1::TYPE_PRINTABLE_STRING]
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* BuiltInDomainDefinedAttributes
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* BuiltInDomainDefinedAttributes
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class BuiltInDomainDefinedAttributes
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => 4, // ub-domain-defined-attributes
'children' => BuiltInDomainDefinedAttribute::MAP
];
}

View File

@ -0,0 +1,71 @@
<?php
/**
* BuiltInStandardAttributes
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* BuiltInStandardAttributes
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class BuiltInStandardAttributes
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'country-name' => ['optional' => true] + CountryName::MAP,
'administration-domain-name' => ['optional' => true] + AdministrationDomainName::MAP,
'network-address' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + NetworkAddress::MAP,
'terminal-identifier' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + TerminalIdentifier::MAP,
'private-domain-name' => [
'constant' => 2,
'optional' => true,
'explicit' => true
] + PrivateDomainName::MAP,
'organization-name' => [
'constant' => 3,
'optional' => true,
'implicit' => true
] + OrganizationName::MAP,
'numeric-user-identifier' => [
'constant' => 4,
'optional' => true,
'implicit' => true
] + NumericUserIdentifier::MAP,
'personal-name' => [
'constant' => 5,
'optional' => true,
'implicit' => true
] + PersonalName::MAP,
'organizational-unit-names' => [
'constant' => 6,
'optional' => true,
'implicit' => true
] + OrganizationalUnitNames::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* CPSuri
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CPSuri
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CPSuri
{
const MAP = ['type' => ASN1::TYPE_IA5_STRING];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* CRLDistributionPoints
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CRLDistributionPoints
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CRLDistributionPoints
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => DistributionPoint::MAP
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* CRLNumber
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CRLNumber
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CRLNumber
{
const MAP = ['type' => ASN1::TYPE_INTEGER];
}

View File

@ -0,0 +1,45 @@
<?php
/**
* CRLReason
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CRLReason
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CRLReason
{
const MAP = [
'type' => ASN1::TYPE_ENUMERATED,
'mapping' => [
'unspecified',
'keyCompromise',
'cACompromise',
'affiliationChanged',
'superseded',
'cessationOfOperation',
'certificateHold',
// Value 7 is not used.
8 => 'removeFromCRL',
'privilegeWithdrawn',
'aACompromise'
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* CertPolicyId
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertPolicyId
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertPolicyId
{
const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Certificate
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Certificate
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Certificate
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'tbsCertificate' => TBSCertificate::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* CertificateIssuer
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificateIssuer
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificateIssuer
{
const MAP = GeneralNames::MAP;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* CertificateList
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificateList
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificateList
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'tbsCertList' => TBSCertList::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* CertificatePolicies
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificatePolicies
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificatePolicies
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => PolicyInformation::MAP
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* CertificateSerialNumber
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificateSerialNumber
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificateSerialNumber
{
const MAP = ['type' => ASN1::TYPE_INTEGER];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* CertificationRequest
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificationRequest
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificationRequest
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'certificationRequestInfo' => CertificationRequestInfo::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,45 @@
<?php
/**
* CertificationRequestInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CertificationRequestInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CertificationRequestInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1']
],
'subject' => Name::MAP,
'subjectPKInfo' => SubjectPublicKeyInfo::MAP,
'attributes' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + Attributes::MAP,
]
];
}

View File

@ -0,0 +1,40 @@
<?php
/**
* CountryName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* CountryName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class CountryName
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
// if class isn't present it's assumed to be \phpseclib\File\ASN1::CLASS_UNIVERSAL or
// (if constant is present) \phpseclib\File\ASN1::CLASS_CONTEXT_SPECIFIC
'class' => ASN1::CLASS_APPLICATION,
'cast' => 1,
'children' => [
'x121-dcc-code' => ['type' => ASN1::TYPE_NUMERIC_STRING],
'iso-3166-alpha2-code' => ['type' => ASN1::TYPE_PRINTABLE_STRING]
]
];
}

View File

@ -0,0 +1,39 @@
<?php
/**
* DirectoryString
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* DirectoryString
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class DirectoryString
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'teletexString' => ['type' => ASN1::TYPE_TELETEX_STRING],
'printableString' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_STRING],
'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING],
'bmpString' => ['type' => ASN1::TYPE_BMP_STRING]
]
];
}

View File

@ -0,0 +1,38 @@
<?php
/**
* DisplayText
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* DisplayText
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class DisplayText
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'ia5String' => ['type' => ASN1::TYPE_IA5_STRING],
'visibleString' => ['type' => ASN1::TYPE_VISIBLE_STRING],
'bmpString' => ['type' => ASN1::TYPE_BMP_STRING],
'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING]
]
];
}

View File

@ -0,0 +1,49 @@
<?php
/**
* DistributionPoint
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* DistributionPoint
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class DistributionPoint
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'distributionPoint' => [
'constant' => 0,
'optional' => true,
'explicit' => true
] + DistributionPointName::MAP,
'reasons' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + ReasonFlags::MAP,
'cRLIssuer' => [
'constant' => 2,
'optional' => true,
'implicit' => true
] + GeneralNames::MAP
]
];
}

View File

@ -0,0 +1,44 @@
<?php
/**
* DistributionPointName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* DistributionPointName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class DistributionPointName
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'fullName' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + GeneralNames::MAP,
'nameRelativeToCRLIssuer' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + RelativeDistinguishedName::MAP
]
];
}

View File

@ -0,0 +1,46 @@
<?php
/**
* EDIPartyName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* EDIPartyName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class EDIPartyName
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'nameAssigner' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + DirectoryString::MAP,
// partyName is technically required but \phpseclib\File\ASN1 doesn't currently support non-optional constants and
// setting it to optional gets the job done in any event.
'partyName' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + DirectoryString::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* EncryptedData
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* EncryptedData
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class EncryptedData
{
const MAP = ['type' => ASN1::TYPE_OCTET_STRING];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* EncryptedPrivateKeyInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* EncryptedPrivateKeyInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class EncryptedPrivateKeyInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'encryptionAlgorithm' => AlgorithmIdentifier::MAP,
'encryptedData' => EncryptedData::MAP
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* ExtKeyUsageSyntax
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* ExtKeyUsageSyntax
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class ExtKeyUsageSyntax
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => KeyPurposeId::MAP
];
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Extension
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Extension
*
* A certificate using system MUST reject the certificate if it encounters
* a critical extension it does not recognize; however, a non-critical
* extension may be ignored if it is not recognized.
*
* http://tools.ietf.org/html/rfc5280#section-4.2
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Extension
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'extnId' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'critical' => [
'type' => ASN1::TYPE_BOOLEAN,
'optional' => true,
'default' => false
],
'extnValue' => ['type' => ASN1::TYPE_OCTET_STRING]
]
];
}

View File

@ -0,0 +1,46 @@
<?php
/**
* ExtensionAttribute
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* ExtensionAttribute
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class ExtensionAttribute
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'extension-attribute-type' => [
'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 0,
'optional' => true,
'implicit' => true
],
'extension-attribute-value' => [
'type' => ASN1::TYPE_ANY,
'constant' => 1,
'optional' => true,
'explicit' => true
]
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* ExtensionAttributes
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* ExtensionAttributes
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class ExtensionAttributes
{
const MAP = [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => 256, // ub-extension-attributes
'children' => ExtensionAttribute::MAP
];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Extensions
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Extensions
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Extensions
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
// technically, it's MAX, but we'll assume anything < 0 is MAX
'max' => -1,
// if 'children' isn't an array then 'min' and 'max' must be defined
'children' => Extension::MAP
];
}

View File

@ -0,0 +1,84 @@
<?php
/**
* GeneralName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* GeneralName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class GeneralName
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'otherName' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + AnotherName::MAP,
'rfc822Name' => [
'type' => ASN1::TYPE_IA5_STRING,
'constant' => 1,
'optional' => true,
'implicit' => true
],
'dNSName' => [
'type' => ASN1::TYPE_IA5_STRING,
'constant' => 2,
'optional' => true,
'implicit' => true
],
'x400Address' => [
'constant' => 3,
'optional' => true,
'implicit' => true
] + ORAddress::MAP,
'directoryName' => [
'constant' => 4,
'optional' => true,
'explicit' => true
] + Name::MAP,
'ediPartyName' => [
'constant' => 5,
'optional' => true,
'implicit' => true
] + EDIPartyName::MAP,
'uniformResourceIdentifier' => [
'type' => ASN1::TYPE_IA5_STRING,
'constant' => 6,
'optional' => true,
'implicit' => true
],
'iPAddress' => [
'type' => ASN1::TYPE_OCTET_STRING,
'constant' => 7,
'optional' => true,
'implicit' => true
],
'registeredID' => [
'type' => ASN1::TYPE_OBJECT_IDENTIFIER,
'constant' => 8,
'optional' => true,
'implicit' => true
]
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* GeneralNames
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* GeneralNames
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class GeneralNames
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => GeneralName::MAP
];
}

View File

@ -0,0 +1,46 @@
<?php
/**
* GeneralSubtree
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* GeneralSubtree
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class GeneralSubtree
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'base' => GeneralName::MAP,
'minimum' => [
'constant' => 0,
'optional' => true,
'implicit' => true,
'default' => '0'
] + BaseDistance::MAP,
'maximum' => [
'constant' => 1,
'optional' => true,
'implicit' => true,
] + BaseDistance::MAP
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* GeneralSubtrees
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* GeneralSubtrees
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class GeneralSubtrees
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => GeneralSubtree::MAP
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* HoldInstructionCode
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* HoldInstructionCode
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class HoldInstructionCode
{
const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* InvalidityDate
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* InvalidityDate
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class InvalidityDate
{
const MAP = ['type' => ASN1::TYPE_GENERALIZED_TIME];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* IssuerAltName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* IssuerAltName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class IssuerAltName
{
const MAP = GeneralNames::MAP;
}

View File

@ -0,0 +1,72 @@
<?php
/**
* IssuingDistributionPoint
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* IssuingDistributionPoint
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class IssuingDistributionPoint
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'distributionPoint' => [
'constant' => 0,
'optional' => true,
'explicit' => true
] + DistributionPointName::MAP,
'onlyContainsUserCerts' => [
'type' => ASN1::TYPE_BOOLEAN,
'constant' => 1,
'optional' => true,
'default' => false,
'implicit' => true
],
'onlyContainsCACerts' => [
'type' => ASN1::TYPE_BOOLEAN,
'constant' => 2,
'optional' => true,
'default' => false,
'implicit' => true
],
'onlySomeReasons' => [
'constant' => 3,
'optional' => true,
'implicit' => true
] + ReasonFlags::MAP,
'indirectCRL' => [
'type' => ASN1::TYPE_BOOLEAN,
'constant' => 4,
'optional' => true,
'default' => false,
'implicit' => true
],
'onlyContainsAttributeCerts' =>[
'type' => ASN1::TYPE_BOOLEAN,
'constant' => 5,
'optional' => true,
'default' => false,
'implicit' => true
]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* KeyIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* KeyIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class KeyIdentifier
{
const MAP = ['type' => ASN1::TYPE_OCTET_STRING];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* KeyPurposeId
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* KeyPurposeId
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class KeyPurposeId
{
const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER];
}

View File

@ -0,0 +1,43 @@
<?php
/**
* KeyUsage
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* KeyUsage
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class KeyUsage
{
const MAP = [
'type' => ASN1::TYPE_BIT_STRING,
'mapping' => [
'digitalSignature',
'nonRepudiation',
'keyEncipherment',
'dataEncipherment',
'keyAgreement',
'keyCertSign',
'cRLSign',
'encipherOnly',
'decipherOnly'
]
];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* Name
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Name
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Name
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'rdnSequence' => RDNSequence::MAP
]
];
}

View File

@ -0,0 +1,44 @@
<?php
/**
* NameConstraints
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* NameConstraints
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class NameConstraints
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'permittedSubtrees' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + GeneralSubtrees::MAP,
'excludedSubtrees' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + GeneralSubtrees::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* NetworkAddress
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* NetworkAddress
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class NetworkAddress
{
const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* NoticeReference
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* NoticeReference
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class NoticeReference
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'organization' => DisplayText::MAP,
'noticeNumbers' => [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => 200,
'children' => ['type' => ASN1::TYPE_INTEGER]
]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* NumericUserIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* NumericUserIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class NumericUserIdentifier
{
const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* ORAddress
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* ORAddress
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class ORAddress
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'built-in-standard-attributes' => BuiltInStandardAttributes::MAP,
'built-in-domain-defined-attributes' => ['optional' => true] + BuiltInDomainDefinedAttributes::MAP,
'extension-attributes' => ['optional' => true] + ExtensionAttributes::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* OrganizationName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* OrganizationName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class OrganizationName
{
const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING];
}

View File

@ -0,0 +1,35 @@
<?php
/**
* OrganizationalUnitNames
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* OrganizationalUnitNames
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class OrganizationalUnitNames
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => 4, // ub-organizational-units
'children' => ['type' => ASN1::TYPE_PRINTABLE_STRING]
];
}

View File

@ -0,0 +1,38 @@
<?php
/**
* OtherPrimeInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* OtherPrimeInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class OtherPrimeInfo
{
// version must be multi if otherPrimeInfos present
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'prime' => ['type' => ASN1::TYPE_INTEGER], // ri
'exponent' => ['type' => ASN1::TYPE_INTEGER], // di
'coefficient' => ['type' => ASN1::TYPE_INTEGER] // ti
]
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* OtherPrimeInfos
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* OtherPrimeInfos
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class OtherPrimeInfos
{
// version must be multi if otherPrimeInfos present
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => OtherPrimeInfo::MAP
];
}

View File

@ -0,0 +1,38 @@
<?php
/**
* PBEParameter
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PBEParameter
*
* from https://tools.ietf.org/html/rfc2898#appendix-A.3
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PBEParameter
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'salt' => ['type' => ASN1::TYPE_OCTET_STRING],
'iterationCount' => ['type' => ASN1::TYPE_INTEGER]
]
];
}

View File

@ -0,0 +1,38 @@
<?php
/**
* PBES2params
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PBES2params
*
* from https://tools.ietf.org/html/rfc2898#appendix-A.3
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PBES2params
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'keyDerivationFunc'=> AlgorithmIdentifier::MAP,
'encryptionScheme' => AlgorithmIdentifier::MAP
]
];
}

View File

@ -0,0 +1,45 @@
<?php
/**
* PBKDF2params
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PBKDF2params
*
* from https://tools.ietf.org/html/rfc2898#appendix-A.3
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PBKDF2params
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
// technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder
// in the RFC
'salt'=> ['type' => ASN1::TYPE_OCTET_STRING],
'iterationCount'=> ['type' => ASN1::TYPE_INTEGER],
'keyLength' => [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
],
'prf' => AlgorithmIdentifier::MAP + ['optional' => true]
]
];
}

View File

@ -0,0 +1,38 @@
<?php
/**
* PBMAC1params
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PBMAC1params
*
* from https://tools.ietf.org/html/rfc2898#appendix-A.3
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PBMAC1params
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'keyDerivationFunc'=> AlgorithmIdentifier::MAP,
'messageAuthScheme'=> AlgorithmIdentifier::MAP
]
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PKCS9String
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PKCS9String
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PKCS9String
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'ia5String' => ['type' => ASN1::TYPE_IA5_STRING],
'directoryString' => DirectoryString::MAP
]
];
}

View File

@ -0,0 +1,58 @@
<?php
/**
* PersonalName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PersonalName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PersonalName
{
const MAP = [
'type' => ASN1::TYPE_SET,
'children' => [
'surname' => [
'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 0,
'optional' => true,
'implicit' => true
],
'given-name' => [
'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 1,
'optional' => true,
'implicit' => true
],
'initials' => [
'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 2,
'optional' => true,
'implicit' => true
],
'generation-qualifier' => [
'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 3,
'optional' => true,
'implicit' => true
]
]
];
}

View File

@ -0,0 +1,42 @@
<?php
/**
* PolicyInformation
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PolicyInformation
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PolicyInformation
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'policyIdentifier' => CertPolicyId::MAP,
'policyQualifiers' => [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 0,
'max' => -1,
'optional' => true,
'children' => PolicyQualifierInfo::MAP
]
]
];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* PolicyMappings
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PolicyMappings
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PolicyMappings
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'issuerDomainPolicy' => CertPolicyId::MAP,
'subjectDomainPolicy' => CertPolicyId::MAP
]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* PolicyQualifierId
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PolicyQualifierId
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PolicyQualifierId
{
const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PolicyQualifierInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PolicyQualifierInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PolicyQualifierInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'policyQualifierId' => PolicyQualifierId::MAP,
'qualifier' => ['type' => ASN1::TYPE_ANY]
]
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PostalAddress
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PostalAddress
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PostalAddress
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'optional' => true,
'min' => 1,
'max' => -1,
'children' => DirectoryString::MAP
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PrivateDomainName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PrivateDomainName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PrivateDomainName
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING],
'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* PrivateKey
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PrivateKey
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PrivateKey
{
const MAP = ['type' => ASN1::TYPE_OCTET_STRING];
}

View File

@ -0,0 +1,45 @@
<?php
/**
* PrivateKeyInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PrivateKeyInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PrivateKeyInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1']
],
'privateKeyAlgorithm'=> AlgorithmIdentifier::MAP,
'privateKey' => PrivateKey::MAP,
'attributes' => [
'constant' => 0,
'optional' => true,
'implicit' => true
] + Attributes::MAP
]
];
}

View File

@ -0,0 +1,44 @@
<?php
/**
* PrivateKeyUsagePeriod
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PrivateKeyUsagePeriod
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PrivateKeyUsagePeriod
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'notBefore' => [
'constant' => 0,
'optional' => true,
'implicit' => true,
'type' => ASN1::TYPE_GENERALIZED_TIME],
'notAfter' => [
'constant' => 1,
'optional' => true,
'implicit' => true,
'type' => ASN1::TYPE_GENERALIZED_TIME]
]
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PublicKeyAndChallenge
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PublicKeyAndChallenge
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PublicKeyAndChallenge
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'spki' => SubjectPublicKeyInfo::MAP,
'challenge' => ['type' => ASN1::TYPE_IA5_STRING]
]
];
}

View File

@ -0,0 +1,39 @@
<?php
/**
* PublicKeyInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* PublicKeyInfo
*
* this format is not formally defined anywhere but is none-the-less the form you
* get when you do "openssl rsa -in private.pem -outform PEM -pubout"
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class PublicKeyInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'publicKeyAlgorithm'=> AlgorithmIdentifier::MAP,
'publicKey' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* RC2CBCParameter
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RC2CBCParameter
*
* from https://tools.ietf.org/html/rfc2898#appendix-A.3
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RC2CBCParameter
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'rc2ParametersVersion'=> [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
],
'iv'=> ['type' => ASN1::TYPE_OCTET_STRING]
]
];
}

View File

@ -0,0 +1,42 @@
<?php
/**
* RDNSequence
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RDNSequence
*
* In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare,
* but they can be useful at times when either there is no unique attribute in the entry or you
* want to ensure that the entry's DN contains some useful identifying information.
*
* - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RDNSequence
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
// RDNSequence does not define a min or a max, which means it doesn't have one
'min' => 0,
'max' => -1,
'children' => RelativeDistinguishedName::MAP
];
}

View File

@ -0,0 +1,48 @@
<?php
/**
* RSAPrivateKey
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RSAPrivateKey
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RSAPrivateKey
{
// version must be multi if otherPrimeInfos present
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['two-prime', 'multi']
],
'modulus' => ['type' => ASN1::TYPE_INTEGER], // n
'publicExponent' => ['type' => ASN1::TYPE_INTEGER], // e
'privateExponent' => ['type' => ASN1::TYPE_INTEGER], // d
'prime1' => ['type' => ASN1::TYPE_INTEGER], // p
'prime2' => ['type' => ASN1::TYPE_INTEGER], // q
'exponent1' => ['type' => ASN1::TYPE_INTEGER], // d mod (p-1)
'exponent2' => ['type' => ASN1::TYPE_INTEGER], // d mod (q-1)
'coefficient' => ['type' => ASN1::TYPE_INTEGER], // (inverse of q) mod p
'otherPrimeInfos' => OtherPrimeInfos::MAP + ['optional' => true]
]
];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* RSAPublicKey
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RSAPublicKey
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RSAPublicKey
{
// version must be multi if otherPrimeInfos present
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'modulus' => ['type' => ASN1::TYPE_INTEGER],
'publicExponent' => ['type' => ASN1::TYPE_INTEGER]
]
];
}

View File

@ -0,0 +1,43 @@
<?php
/**
* ReasonFlags
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* ReasonFlags
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class ReasonFlags
{
const MAP = [
'type' => ASN1::TYPE_BIT_STRING,
'mapping' => [
'unused',
'keyCompromise',
'cACompromise',
'affiliationChanged',
'superseded',
'cessationOfOperation',
'certificateHold',
'privilegeWithdrawn',
'aACompromise'
]
];
}

View File

@ -0,0 +1,41 @@
<?php
/**
* RelativeDistinguishedName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RelativeDistinguishedName
*
* In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare,
* but they can be useful at times when either there is no unique attribute in the entry or you
* want to ensure that the entry's DN contains some useful identifying information.
*
* - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RelativeDistinguishedName
{
const MAP = [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => -1,
'children' => AttributeTypeAndValue::MAP
];
}

View File

@ -0,0 +1,39 @@
<?php
/**
* RevokedCertificate
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* RevokedCertificate
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class RevokedCertificate
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'userCertificate' => CertificateSerialNumber::MAP,
'revocationDate' => Time::MAP,
'crlEntryExtensions' => [
'optional' => true
] + Extensions::MAP
]
];
}

View File

@ -0,0 +1,37 @@
<?php
/**
* SignedPublicKeyAndChallenge
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* SignedPublicKeyAndChallenge
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class SignedPublicKeyAndChallenge
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'publicKeyAndChallenge' => PublicKeyAndChallenge::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* SubjectAltName
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* SubjectAltName
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class SubjectAltName
{
const MAP = GeneralNames::MAP;
}

View File

@ -0,0 +1,35 @@
<?php
/**
* SubjectDirectoryAttributes
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* SubjectDirectoryAttributes
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class SubjectDirectoryAttributes
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'min' => 1,
'max' => -1,
'children' => Attribute::MAP
];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* SubjectPublicKeyInfo
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* SubjectPublicKeyInfo
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class SubjectPublicKeyInfo
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'algorithm' => AlgorithmIdentifier::MAP,
'subjectPublicKey' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
}

View File

@ -0,0 +1,56 @@
<?php
/**
* TBSCertList
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* TBSCertList
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class TBSCertList
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'version' => [
'optional' => true,
'default' => 'v1'
] + Version::MAP,
'signature' => AlgorithmIdentifier::MAP,
'issuer' => Name::MAP,
'thisUpdate' => Time::MAP,
'nextUpdate' => [
'optional' => true
] + Time,
'revokedCertificates' => [
'type' => ASN1::TYPE_SEQUENCE,
'optional' => true,
'min' => 0,
'max' => -1,
'children' => RevokedCertificate::MAP
],
'crlExtensions' => [
'constant' => 0,
'optional' => true,
'explicit' => true
] + Extensions::MAP
]
];
}

View File

@ -0,0 +1,69 @@
<?php
/**
* TBSCertificate
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* TBSCertificate
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class TBSCertificate
{
// assert($TBSCertificate['children']['signature'] == $Certificate['children']['signatureAlgorithm'])
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
// technically, default implies optional, but we'll define it as being optional, none-the-less, just to
// reenforce that fact
'version' => [
'type' => ASN1::TYPE_INTEGER,
'constant' => 0,
'optional' => true,
'explicit' => true,
'mapping' => ['v1', 'v2', 'v3'],
'default' => 'v1'
],
'serialNumber' => CertificateSerialNumber::MAP,
'signature' => AlgorithmIdentifier::MAP,
'issuer' => Name::MAP,
'validity' => Validity::MAP,
'subject' => Name::MAP,
'subjectPublicKeyInfo' => SubjectPublicKeyInfo::MAP,
// implicit means that the T in the TLV structure is to be rewritten, regardless of the type
'issuerUniqueID' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + UniqueIdentifier::MAP,
'subjectUniqueID' => [
'constant' => 2,
'optional' => true,
'implicit' => true
] + UniqueIdentifier::MAP,
// <http://tools.ietf.org/html/rfc2459#page-74> doesn't use the EXPLICIT keyword but if
// it's not IMPLICIT, it's EXPLICIT
'extensions' => [
'constant' => 3,
'optional' => true,
'explicit' => true
] + Extensions::MAP
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* TerminalIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* TerminalIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class TerminalIdentifier
{
const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING];
}

View File

@ -0,0 +1,36 @@
<?php
/**
* Time
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* Time
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class Time
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
'children' => [
'utcTime' => ['type' => ASN1::TYPE_UTC_TIME],
'generalTime' => ['type' => ASN1::TYPE_GENERALIZED_TIME]
]
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* UniqueIdentifier
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* UniqueIdentifier
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class UniqueIdentifier
{
const MAP = ['type' => ASN1::TYPE_BIT_STRING];
}

View File

@ -0,0 +1,42 @@
<?php
/**
* UserNotice
*
* PHP version 5
*
* @category File
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @copyright 2016 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
namespace phpseclib\File\ASN1;
use phpseclib\File\ASN1;
/**
* UserNotice
*
* @package ASN1
* @author Jim Wigginton <terrafrost@php.net>
* @access public
*/
class UserNotice
{
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'noticeRef' => [
'optional' => true,
'implicit' => true
] + NoticeReference::MAP,
'explicitText' => [
'optional' => true,
'implicit' => true
] + DisplayText::MAP
]
];
}

Some files were not shown because too many files have changed in this diff Show More