certificate.verifySpkac()

certificate.verifySpkac(spkac) Returns true if the given spkac data structure is valid, false otherwise. The spkac argument must be a Node.js Buffer. const cert = require('crypto').Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(new Buffer(spkac))); // Prints true or false

checkContinue event (http.Server)

Event: 'checkContinue' function (request, response) { } Emitted each time a request with an http Expect: 100-continue is received. If this event isn't listened for, the server will automatically respond with a 100 Continue as appropriate. Handling this event involves calling response.writeContinue() if the client should continue to send the request body, or generating an appropriate HTTP response (e.g., 400 Bad Request) if the client should not continue to send the request body. Note that wh

certificate.exportChallenge()

certificate.exportChallenge(spkac) The spkac data structure includes a public key and a challenge. The certificate.exportChallenge() returns the challenge component in the form of a Node.js Buffer. The spkac argument can be either a string or a Buffer. const cert = require('crypto').Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints the challenge as a UTF8 string

Certificate

Class: Certificate SPKAC is a Certificate Signing Request mechanism originally implemented by Netscape and now specified formally as part of HTML5's keygen element. The crypto module provides the Certificate class for working with SPKAC data. The most common usage is handling output generated by the HTML5 <keygen> element. Node.js uses OpenSSL's SPKAC implementation internally.

certificate.exportPublicKey()

certificate.exportPublicKey(spkac) The spkac data structure includes a public key and a challenge. The certificate.exportPublicKey() returns the public key component in the form of a Node.js Buffer. The spkac argument can be either a string or a Buffer. const cert = require('crypto').Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints the public key as <Buffer ...>

C/C++ Addons

Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the require() function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries. At the moment, the method for implementing Addons is rather complicated, involving knowledge of several components and APIs : V8: the C++ library Node.js currently uses to provide the JavaScript

buffer[]

buf[index] The index operator [index] can be used to get and set the octet at position index in the Buffer. The values refer to individual bytes, so the legal value range is between 0x00 and 0xFF (hex) or 0 and 255 (decimal). Example: copy an ASCII string into a Buffer, one byte at a time: const str = "Node.js"; const buf = Buffer.allocUnsafe(str.length); for (var i = 0; i < str.length ; i++) { buf[i] = str.charCodeAt(i); } console.log(buf.toString('ascii')); // Prints: Node.js

buffer.writeUIntBE()

buf.writeUIntBE(value, offset, byteLength[, noAssert])

buffer.writeUIntLE()

buf.writeUIntLE(value, offset, byteLength[, noAssert]) value <Number> Bytes to be written to Buffer offset <Number> 0 <= offset <= buf.length - byteLength byteLength <Number> 0 < byteLength <= 6 noAssert <Boolean> Default: false Return: <Number> The offset plus the number of written bytes Writes value to the Buffer at the specified offset and byteLength. Supports up to 48 bits of accuracy. For example: const buf = Buffer.allocUnsafe(6); buf.wri

buffer.writeUInt8()

buf.writeUInt8(value, offset[, noAssert]) value <Number> Bytes to be written to Buffer offset <Number> 0 <= offset <= buf.length - 1 noAssert <Boolean> Default: false Return: <Number> The offset plus the number of written bytes Writes value to the Buffer at the specified offset. The value should be a valid unsigned 8-bit integer. Behavior is not defined when value is anything other than an unsigned 8-bit integer. Set noAssert to true to skip validation of va