Comparing version 1.0.1 to 1.0.2
@@ -197,3 +197,3 @@ /* | ||
var str = int_buffer[i].toString(16).toUpperCase(); | ||
result = result + ((str.length === 1) ? " 0" : " ") + str; | ||
result = result + ((str.length === 1) ? "0" : "") + str; | ||
} | ||
@@ -200,0 +200,0 @@ |
@@ -8,3 +8,3 @@ { | ||
"description": "ASN1js is a pure JavaScript library implementing this standard. ASN.1 is the basis of all X.509 related data structures and numerous other protocols used on the web", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"repository": { | ||
@@ -11,0 +11,0 @@ "type": "git", |
@@ -130,2 +130,42 @@ ## ASN1js | ||
## How to use ASN1js and PKIjs with Node.js | ||
!!! WARNING !!! | ||
Currently there is no "polyfill" of WebCrypto in Node.js. Thus you will not be able to use signature / verification features of PKIjs in Node.js programs. | ||
In order to use PKIjs you will also need [ASN1js][] plus [node.extend](https://www.npmjs.com/package/node.extend) package. | ||
```javascript | ||
var merge = require("node.extend"); | ||
var common = require("asn1js/org/pkijs/common"); | ||
var _asn1js = require("asn1js"); | ||
var _pkijs = require("pkijs"); | ||
var _x509schema = require("pkijs/org/pkijs/x509_schema"); | ||
// #region Merging function/object declarations for ASN1js and PKIjs | ||
var asn1js = merge(true, _asn1js, common); | ||
var x509schema = merge(true, _x509schema, asn1js); | ||
var pkijs_1 = merge(true, _pkijs, asn1js); | ||
var pkijs = merge(true, pkijs_1, x509schema); | ||
// #endregion | ||
``` | ||
After that you will ba able to use ASN1js and PKIjs via common way: | ||
```javascript | ||
// #region Decode and parse X.509 cert | ||
var asn1 = pkijs.org.pkijs.fromBER(certBuffer); | ||
var cert; | ||
try | ||
{ | ||
cert = new pkijs.org.pkijs.simpl.CERT({ schema: asn1.result }); | ||
} | ||
catch(ex) | ||
{ | ||
return; | ||
} | ||
// #endregion | ||
``` | ||
## License | ||
@@ -132,0 +172,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
249197
4749
209