node_modules/node-forge/lib/pkcs7.js
/**
 * Converts a single signer from an ASN.1 object.
 *
 * @param obj the ASN.1 representation of a SignerInfo.
 *
 * @return the signer object.
 */
Converts a single signer from an ASN.1 object.
@param obj the ASN.1 representation of a SignerInfo.

@return the signer object.
Converts a single signer from an ASN . 1 object . @param obj the ASN . 1 representation of a SignerInfo . @return the signer object .
function _signerFromAsn1(obj) {
  var capture = {};
  var errors = [];
  if(!asn1.validate(obj, p7.asn1.signerInfoValidator, capture, errors)) {
    var error = new Error('Cannot read PKCS#7 SignerInfo. ' +
      'ASN.1 object is not an PKCS#7 SignerInfo.');
    error.errors = errors;
    throw error;
  }
  var rval = {
    version: capture.version.charCodeAt(0),
    issuer: forge.pki.RDNAttributesAsArray(capture.issuer),
    serialNumber: forge.util.createBuffer(capture.serial).toHex(),
    digestAlgorithm: asn1.derToOid(capture.digestAlgorithm),
    signatureAlgorithm: asn1.derToOid(capture.signatureAlgorithm),
    signature: capture.signature,
    authenticatedAttributes: [],
    unauthenticatedAttributes: []
  };
  var authenticatedAttributes = capture.authenticatedAttributes || [];
  var unauthenticatedAttributes = capture.unauthenticatedAttributes || [];
  return rval;
}
function _signerFromAsn1 ( obj ) { var capture = { } ; var errors = [ ] ; if ( ! asn1 . validate ( obj , p7 . asn1 . signerInfoValidator , capture , errors ) ) { var error = new Error ( 'Cannot read PKCS#7 SignerInfo. ' + 'ASN.1 object is not an PKCS#7 SignerInfo.' ) ; error . errors = errors ; throw error ; } var rval = { version : capture . version . charCodeAt ( 0 ) , issuer : forge . pki . RDNAttributesAsArray ( capture . issuer ) , serialNumber : forge . util . createBuffer ( capture . serial ) . toHex ( ) , digestAlgorithm : asn1 . derToOid ( capture . digestAlgorithm ) , signatureAlgorithm : asn1 . derToOid ( capture . signatureAlgorithm ) , signature : capture . signature , authenticatedAttributes : [ ] , unauthenticatedAttributes : [ ] } ; var authenticatedAttributes = capture . authenticatedAttributes || [ ] ; var unauthenticatedAttributes = capture . unauthenticatedAttributes || [ ] ; return rval ; }
Converts a single signer from an ASN.1 object.
Converts a single signer from an ASN . 1 object .
// validate EnvelopedData content block and capture data // TODO: convert attributes