Firebase Update

This commit is contained in:
Lukas Nowy
2018-12-22 23:30:39 +01:00
parent befb44764d
commit acffe619b3
11523 changed files with 1614327 additions and 930246 deletions

View File

@ -215,7 +215,7 @@ function sha512(msg, msgLen) {
var md = forge.md.sha512.create();
var buffer = new ByteBuffer(msg);
md.update(buffer.getBytes(msgLen), 'binary');
var hash = md.digest().getBytes();
const hash = md.digest().getBytes();
if(typeof Buffer !== 'undefined') {
return new Buffer(hash, 'binary');
}

View File

@ -328,11 +328,8 @@ p7.createSignedData = function() {
/**
* Signs the content.
* @param options Options to apply when signing:
* [detached] boolean. If signing should be done in detached mode. Defaults to false.
*/
sign: function(options) {
options = options || {};
sign: function() {
// auto-generate content info
if(typeof msg.content !== 'object' || msg.contentInfo === null) {
// use Data ContentInfo
@ -352,16 +349,12 @@ p7.createSignedData = function() {
content = forge.util.encodeUtf8(msg.content);
}
if (options.detached) {
msg.detachedContent = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, content);
} else {
msg.contentInfo.value.push(
// [0] EXPLICIT content
asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [
asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false,
content)
]));
}
msg.contentInfo.value.push(
// [0] EXPLICIT content
asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [
asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false,
content)
]));
}
}
@ -444,22 +437,10 @@ p7.createSignedData = function() {
}
function addSignerInfos(mds) {
var content;
if (msg.detachedContent) {
// Signature has been made in detached mode.
content = msg.detachedContent;
} else {
// Note: ContentInfo is a SEQUENCE with 2 values, second value is
// the content field and is optional for a ContentInfo but required here
// since signers are present
// get ContentInfo content
content = msg.contentInfo.value[1];
// skip [0] EXPLICIT content wrapper
content = content.value[0];
}
if(!content) {
// Note: ContentInfo is a SEQUENCE with 2 values, second value is
// the content field and is optional for a ContentInfo but required here
// since signers are present
if(msg.contentInfo.value.length < 2) {
throw new Error(
'Could not sign PKCS#7 message; there is no content to sign.');
}
@ -467,6 +448,11 @@ p7.createSignedData = function() {
// get ContentInfo content type
var contentType = asn1.derToOid(msg.contentInfo.value[0].value);
// get ContentInfo content
var content = msg.contentInfo.value[1];
// skip [0] EXPLICIT content wrapper
content = content.value[0];
// serialize content
var bytes = asn1.toDer(content);

View File

@ -13,10 +13,8 @@ var util = module.exports = forge.util = forge.util || {};
// define setImmediate and nextTick
(function() {
// use native nextTick (unless we're in webpack)
// webpack (or better node-libs-browser polyfill) sets process.browser.
// this way we can detect webpack properly
if(typeof process !== 'undefined' && process.nextTick && !process.browser) {
// use native nextTick
if(typeof process !== 'undefined' && process.nextTick) {
util.nextTick = process.nextTick;
if(typeof setImmediate === 'function') {
util.setImmediate = setImmediate;