summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorJason Gerfen <jason.gerfen@gmail.com>2013-10-10 13:24:53 -0700
committerTrevor Norris <trev.norris@gmail.com>2013-10-16 09:43:19 -0700
commit7bf46ba4cedefe8d3b6548a314ad64fc0cfd89f1 (patch)
treebf3915932b952cae180c7d7e5277089216d1bf3c /lib/crypto.js
parenta555992d5ebd93ae873f002e8ff26dba596a62b8 (diff)
downloadandroid-node-v8-7bf46ba4cedefe8d3b6548a314ad64fc0cfd89f1.tar.gz
android-node-v8-7bf46ba4cedefe8d3b6548a314ad64fc0cfd89f1.tar.bz2
android-node-v8-7bf46ba4cedefe8d3b6548a314ad64fc0cfd89f1.zip
crypto: add SPKAC support
Implements new class 'Certificate' within crypto object for working with SPKAC's (signed public key & challenge) natively.
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 9cfc09e3c0..4f4e7e1c80 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -573,6 +573,30 @@ function pbkdf2(password, salt, iterations, keylen, callback) {
}
+exports.Certificate = Certificate;
+
+function Certificate() {
+ if (!(this instanceof Certificate))
+ return new Certificate();
+
+ this._binding = new binding.Certificate();
+}
+
+
+Certificate.prototype.verifySpkac = function(object) {
+ return this._binding.verifySpkac(object);
+};
+
+
+Certificate.prototype.exportPublicKey = function(object, encoding) {
+ return this._binding.exportPublicKey(toBuf(object, encoding));
+};
+
+
+Certificate.prototype.exportChallenge = function(object, encoding) {
+ return this._binding.exportChallenge(toBuf(object, encoding));
+};
+
exports.randomBytes = randomBytes;
exports.pseudoRandomBytes = pseudoRandomBytes;