How to use the pkijs.BasicOCSPResponse function in pkijs

To help you get started, we’ve selected a few pkijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / CAdES.js / examples / CAdESComplexExample / es6.js View on Github external
.then(result =>
		{
			// noinspection JSCheckFunctionSignatures
			asn1 = asn1js.fromBER(result);
			let ocspResponse = new OCSPResponse({ schema: asn1.result });
			
			if(("crls" in cmsSignedSimpl) === false)
				cmsSignedSimpl.crls = [];
			
			const asn1Temp = asn1js.fromBER(ocspResponse.responseBytes.response.valueBlock.valueHex);
			const tempResponse = new BasicOCSPResponse({ schema: asn1Temp.result });
			
			cmsSignedSimpl.crls.push(new OtherRevocationInfoFormat({
				otherRevInfoFormat: ocspResponse.responseBytes.responseType,
				otherRevInfo: tempResponse.toSchema()
			}));
		});
github PeculiarVentures / CAdES.js / examples / CAdESComplexExample / es6.js View on Github external
})
								]
							}),
							thisUpdate: getUTCDate(new Date())
						});
						
						responses.push(response);
					}
				}
			}
			//endregion 
		}
		//endregion 
		
		//region Making final OCSP response object 
		basicResponse = new BasicOCSPResponse({
			tbsResponseData: new ResponseData({
				responderID: certSimpl.subject,
				producedAt: getUTCDate(new Date()),
				responses: responses
			}),
			signatureAlgorithm: certSimpl.signatureAlgorithm,
			certs: [certSimpl]
		});
		
		ocspResponse = new OCSPResponse({
			responseStatus: new asn1js.Enumerated({ value: 0 }) // successful
		});
		//endregion 
	});
github PeculiarVentures / CAdES.js / examples / CAdESComplexExample / es6.js View on Github external
.then(result =>
		{
			// noinspection JSCheckFunctionSignatures
			asn1 = asn1js.fromBER(result);
			ocspResponse = new OCSPResponse({ schema: asn1.result });
			
			if(("crls" in cmsSignedSimpl) === false)
				cmsSignedSimpl.crls = [];
			
			const asn1Temp = asn1js.fromBER(ocspResponse.responseBytes.response.valueBlock.valueHex);
			const basicResponse = new BasicOCSPResponse({ schema: asn1Temp.result });
			
			//region Append OCSP certificates into "certificates" array
			if("certs" in basicResponse)
			{
				if(("certificates" in cmsSignedSimpl) === false)
					cmsSignedSimpl.certificates = [];
				
				for(let i = 0; i < basicResponse.certs.length; i++)
					cmsSignedSimpl.certificates.push(basicResponse.certs[i]);
			}
			//endregion
			
			cmsSignedSimpl.certificates.push(caCertSimpl);
		});
github PeculiarVentures / CAdES.js / src / OcspIdentifier.js View on Github external
//endregion
		
		//region Check input parameters
		if("ocspResponse" in parameters)
			ocspResponse = parameters.ocspResponse; // in_window.org.pkijs.simpl.OCSP_RESPONSE
		else
			throw new Error("Parameter \"ocspResponse\" is mandatory for making \"OcspResponsesID\"");
		//endregion
		
		//region Fill internal fields
		if("responseBytes" in ocspResponse)
		{
			if(ocspResponse.responseBytes.responseType === "1.3.6.1.5.5.7.48.1.1") // id-pkix-ocsp-basic
			{
				const asn1 = asn1js.fromBER(ocspResponse.responseBytes.response.valueBlock.valueHex);
				const basicResponse = new BasicOCSPResponse({ schema: asn1.result });
				
				if(basicResponse.tbsResponseData.responderID instanceof RelativeDistinguishedNames)
				{
					this.ocspResponderID = new asn1js.Constructed({
						idBlock: {
							tagClass: 3, // CONTEXT-SPECIFIC
							tagNumber: 1 // [1]
						},
						value: [basicResponse.tbsResponseData.responderID.toSchema()]
					});
				}
				else
				{
					this.ocspResponderID = new asn1js.Constructed({
						idBlock: {
							tagClass: 3, // CONTEXT-SPECIFIC
github PeculiarVentures / CAdES.js / src / RevocationValues.js View on Github external
}
		}
		//endregion 
		
		//region Put information about all OCSP responses 
		if(ocspResponses.length)
		{
			this.ocspVals = [];
			
			for(let i = 0; i < ocspResponses.length; i++)
			{
				const asn1 = asn1js.fromBER(ocspResponses[i]);
				const ocspResponse = new OCSPResponse({ schema: asn1.result });
				
				const asn1Basic = asn1js.fromBER(ocspResponse.responseBytes.response.valueBlock.valueHex);
				const basicResponse = new BasicOCSPResponse({ schema: asn1Basic.result });
				
				this.ocspVals.push(basicResponse);
			}
		}
		//endregion 
	}
	//**********************************************************************************

pkijs

Public Key Infrastructure (PKI) is the basis of how identity and key management is performed on the web today. PKIjs is a pure JavaScript library implementing the formats that are used in PKI applications. It is built on WebCrypto and aspires to make it p

BSD-3-Clause
Latest version published 4 months ago

Package Health Score

78 / 100
Full package analysis