web_modules/forge.bundle.js
function _signatureParametersToAsn1(oid, params) {
  switch(oid) {
  case oids['RSASSA-PSS']:
    var parts = [];

    if(params.hash.algorithmOid !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
            asn1.oidToDer(params.hash.algorithmOid).getBytes()),
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')
        ])
      ]));
    }

    if(params.mgf.algorithmOid !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
            asn1.oidToDer(params.mgf.algorithmOid).getBytes()),
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
            asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
              asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()),
            asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')
          ])
        ])
      ]));
    }

    if(params.saltLength !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,
          asn1.integerToDer(params.saltLength).getBytes())
      ]));
    }

    return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts);

  default:
    return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '');
  }
}
function _signatureParametersToAsn1(oid, params) {
  switch(oid) {
  case oids['RSASSA-PSS']:
    var parts = [];

    if(params.hash.algorithmOid !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
            asn1.oidToDer(params.hash.algorithmOid).getBytes()),
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')
        ])
      ]));
    }

    if(params.mgf.algorithmOid !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
            asn1.oidToDer(params.mgf.algorithmOid).getBytes()),
          asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
            asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,
              asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()),
            asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')
          ])
        ])
      ]));
    }

    if(params.saltLength !== undefined) {
      parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [
        asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,
          asn1.integerToDer(params.saltLength).getBytes())
      ]));
    }

    return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts);

  default:
    return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '');
  }
}
function _signatureParametersToAsn1 ( oid , params ) { switch ( oid ) { case oids [ 'RSASSA-PSS' ] : var parts = [ ] ; if ( params . hash . algorithmOid !== undefined ) { parts . push ( asn1 . create ( asn1 . Class . CONTEXT_SPECIFIC , 0 , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . SEQUENCE , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . OID , false , asn1 . oidToDer ( params . hash . algorithmOid ) . getBytes ( ) ) , asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . NULL , false , '' ) ] ) ] ) ) ; } if ( params . mgf . algorithmOid !== undefined ) { parts . push ( asn1 . create ( asn1 . Class . CONTEXT_SPECIFIC , 1 , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . SEQUENCE , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . OID , false , asn1 . oidToDer ( params . mgf . algorithmOid ) . getBytes ( ) ) , asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . SEQUENCE , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . OID , false , asn1 . oidToDer ( params . mgf . hash . algorithmOid ) . getBytes ( ) ) , asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . NULL , false , '' ) ] ) ] ) ] ) ) ; } if ( params . saltLength !== undefined ) { parts . push ( asn1 . create ( asn1 . Class . CONTEXT_SPECIFIC , 2 , true , [ asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . INTEGER , false , asn1 . integerToDer ( params . saltLength ) . getBytes ( ) ) ] ) ) ; } return asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . SEQUENCE , true , parts ) ; default : return asn1 . create ( asn1 . Class . UNIVERSAL , asn1 . Type . NULL , false , '' ) ; } }
Convert signature parameters object to ASN.1

@param {String} oid Signature algorithm OID
@param params The signature parametrs object
@return ASN.1 object representing signature parameters
Convert signature parameters object to ASN . 1