adapik / cms Goto Github PK
View Code? Open in Web Editor NEWA PHP Library that allows you to decode ASN.1 CMS using Basic Encoding Rules (BER)
License: MIT License
A PHP Library that allows you to decode ASN.1 CMS using Basic Encoding Rules (BER)
License: MIT License
Use a structure (array or json) to describe rfc schema of library objects. Now without validation a lot of checks need to be done for perventing errors in case of malformed data. Validation by schema may also form a structure which can be used in access methods. Sсhema should includes options:
Can you add additional clases to mapping, cause it can be also part of unsiged data?
abstract class OCSPRequest
{
/*
https://tools.ietf.org/html/rfc5280
OCSPRequest ::= SEQUENCE {
tbsRequest TBSRequest,
optionalSignature [0] EXPLICIT Signature OPTIONAL
}
*/
const MAP = [
'type' => Identifier::SEQUENCE,
'children' => [
'tbsRequest' => [ 'type' => TBSRequest::MAP ],
'optionalSignature' => [
'type' => Signature::MAP,
'optional' => true,
'explicit' => true,
'constant' => 0,
],
],
];
}
abstract class TBSRequest
{
/*
TBSRequest ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
requestorName [1] EXPLICIT GeneralName OPTIONAL,
requestList SEQUENCE OF Request,
requestExtensions [2] EXPLICIT Extensions OPTIONAL }
*/
const MAP = [
'type' => Identifier::SEQUENCE,
'children' => [
'version' => [
'type' => Identifier::INTEGER,
'constant' => 0,
'optional' => true,
'explicit' => true,
'mapping' => [ 'v1', 'v2', 'v3' ],
'default' => 'v1',
],
'requestorName' => [
'constant' => 1,
'optional' => true,
'explicit' => true,
],
'requestList' => [
'type' => Request::MAP,
],
'requestExtensions' => [
'constant' => 2,
'optional' => true,
'explicit' => true,
] + Extensions::MAP,
],
];
}
abstract class Request
{
/**
* Request ::= SEQUENCE {
* reqCert CertID,
* singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL
* }
*/
const MAP = [
'type' => Identifier::SEQUENCE,
'children' => [
'reqCert' => [ 'type' => CertID::MAP ],
'singleRequestExtensions' => [
'constant' => 0,
'optional' => true,
'explicit' => true,
] + Extensions::MAP,
],
];
}
abstract class CertID
{
/**
* CertID ::= SEQUENCE {
* hashAlgorithm AlgorithmIdentifier,
* issuerNameHash OCTET STRING, -- Hash of Issuer's DN
* issuerKeyHash OCTET STRING, -- Hash of Issuers public key
* serialNumber CertificateSerialNumber
* }
*/
const MAP = [
'type' => Identifier::SEQUENCE,
'children' => [
'hashAlgorithm' => [ 'type' => AlgorithmIdentifier::MAP ],
'issuerNameHash' => [ 'type' => Identifier::OCTETSTRING ],
'issuerKeyHash' => [ 'type' => Identifier::OCTETSTRING ],
'serialNumber' => [ 'type' => CertificateSerialNumber::MAP ],
],
];
}
abstract class Signature
{
/**
* Signature ::= SEQUENCE {
* signatureAlgorithm AlgorithmIdentifier,
* signature BIT STRING,
* certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL
* }
*/
const MAP = [
'type' => Identifier::SEQUENCE,
'children' => [
'signatureAlgorithm' => [ 'type' => AlgorithmIdentifier::MAP ],
'signature' => [ 'type' => Identifier::BITSTRING ],
'certs' => [
'type' => Certificate::MAP,
'optional' => true,
'explicit' => true,
'constant' => 0,
],
],
];
}
Add CRL object
I need to generate a file signed with CadES.
How can I sign a txt file using this package?
Есть инструкция как интегрировать PHP для подписания?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.