"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/sshpk/lib/algs.js" (8 Mar 2017, 4842 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2015 Joyent, Inc.
    2 
    3 var algInfo = {
    4     'dsa': {
    5         parts: ['p', 'q', 'g', 'y'],
    6         sizePart: 'p'
    7     },
    8     'rsa': {
    9         parts: ['e', 'n'],
   10         sizePart: 'n'
   11     },
   12     'ecdsa': {
   13         parts: ['curve', 'Q'],
   14         sizePart: 'Q'
   15     },
   16     'ed25519': {
   17         parts: ['R'],
   18         normalize: false,
   19         sizePart: 'R'
   20     }
   21 };
   22 algInfo['curve25519'] = algInfo['ed25519'];
   23 
   24 var algPrivInfo = {
   25     'dsa': {
   26         parts: ['p', 'q', 'g', 'y', 'x']
   27     },
   28     'rsa': {
   29         parts: ['n', 'e', 'd', 'iqmp', 'p', 'q']
   30     },
   31     'ecdsa': {
   32         parts: ['curve', 'Q', 'd']
   33     },
   34     'ed25519': {
   35         parts: ['R', 'r'],
   36         normalize: false
   37     }
   38 };
   39 algPrivInfo['curve25519'] = algPrivInfo['ed25519'];
   40 
   41 var hashAlgs = {
   42     'md5': true,
   43     'sha1': true,
   44     'sha256': true,
   45     'sha384': true,
   46     'sha512': true
   47 };
   48 
   49 /*
   50  * Taken from
   51  * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf
   52  */
   53 var curves = {
   54     'nistp256': {
   55         size: 256,
   56         pkcs8oid: '1.2.840.10045.3.1.7',
   57         p: new Buffer(('00' +
   58             'ffffffff 00000001 00000000 00000000' +
   59             '00000000 ffffffff ffffffff ffffffff').
   60             replace(/ /g, ''), 'hex'),
   61         a: new Buffer(('00' +
   62             'FFFFFFFF 00000001 00000000 00000000' +
   63             '00000000 FFFFFFFF FFFFFFFF FFFFFFFC').
   64             replace(/ /g, ''), 'hex'),
   65         b: new Buffer((
   66             '5ac635d8 aa3a93e7 b3ebbd55 769886bc' +
   67             '651d06b0 cc53b0f6 3bce3c3e 27d2604b').
   68             replace(/ /g, ''), 'hex'),
   69         s: new Buffer(('00' +
   70             'c49d3608 86e70493 6a6678e1 139d26b7' +
   71             '819f7e90').
   72             replace(/ /g, ''), 'hex'),
   73         n: new Buffer(('00' +
   74             'ffffffff 00000000 ffffffff ffffffff' +
   75             'bce6faad a7179e84 f3b9cac2 fc632551').
   76             replace(/ /g, ''), 'hex'),
   77         G: new Buffer(('04' +
   78             '6b17d1f2 e12c4247 f8bce6e5 63a440f2' +
   79             '77037d81 2deb33a0 f4a13945 d898c296' +
   80             '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' +
   81             '2bce3357 6b315ece cbb64068 37bf51f5').
   82             replace(/ /g, ''), 'hex')
   83     },
   84     'nistp384': {
   85         size: 384,
   86         pkcs8oid: '1.3.132.0.34',
   87         p: new Buffer(('00' +
   88             'ffffffff ffffffff ffffffff ffffffff' +
   89             'ffffffff ffffffff ffffffff fffffffe' +
   90             'ffffffff 00000000 00000000 ffffffff').
   91             replace(/ /g, ''), 'hex'),
   92         a: new Buffer(('00' +
   93             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
   94             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' +
   95             'FFFFFFFF 00000000 00000000 FFFFFFFC').
   96             replace(/ /g, ''), 'hex'),
   97         b: new Buffer((
   98             'b3312fa7 e23ee7e4 988e056b e3f82d19' +
   99             '181d9c6e fe814112 0314088f 5013875a' +
  100             'c656398d 8a2ed19d 2a85c8ed d3ec2aef').
  101             replace(/ /g, ''), 'hex'),
  102         s: new Buffer(('00' +
  103             'a335926a a319a27a 1d00896a 6773a482' +
  104             '7acdac73').
  105             replace(/ /g, ''), 'hex'),
  106         n: new Buffer(('00' +
  107             'ffffffff ffffffff ffffffff ffffffff' +
  108             'ffffffff ffffffff c7634d81 f4372ddf' +
  109             '581a0db2 48b0a77a ecec196a ccc52973').
  110             replace(/ /g, ''), 'hex'),
  111         G: new Buffer(('04' +
  112             'aa87ca22 be8b0537 8eb1c71e f320ad74' +
  113             '6e1d3b62 8ba79b98 59f741e0 82542a38' +
  114             '5502f25d bf55296c 3a545e38 72760ab7' +
  115             '3617de4a 96262c6f 5d9e98bf 9292dc29' +
  116             'f8f41dbd 289a147c e9da3113 b5f0b8c0' +
  117             '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f').
  118             replace(/ /g, ''), 'hex')
  119     },
  120     'nistp521': {
  121         size: 521,
  122         pkcs8oid: '1.3.132.0.35',
  123         p: new Buffer((
  124             '01ffffff ffffffff ffffffff ffffffff' +
  125             'ffffffff ffffffff ffffffff ffffffff' +
  126             'ffffffff ffffffff ffffffff ffffffff' +
  127             'ffffffff ffffffff ffffffff ffffffff' +
  128             'ffff').replace(/ /g, ''), 'hex'),
  129         a: new Buffer(('01FF' +
  130             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
  131             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
  132             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
  133             'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC').
  134             replace(/ /g, ''), 'hex'),
  135         b: new Buffer(('51' +
  136             '953eb961 8e1c9a1f 929a21a0 b68540ee' +
  137             'a2da725b 99b315f3 b8b48991 8ef109e1' +
  138             '56193951 ec7e937b 1652c0bd 3bb1bf07' +
  139             '3573df88 3d2c34f1 ef451fd4 6b503f00').
  140             replace(/ /g, ''), 'hex'),
  141         s: new Buffer(('00' +
  142             'd09e8800 291cb853 96cc6717 393284aa' +
  143             'a0da64ba').replace(/ /g, ''), 'hex'),
  144         n: new Buffer(('01ff' +
  145             'ffffffff ffffffff ffffffff ffffffff' +
  146             'ffffffff ffffffff ffffffff fffffffa' +
  147             '51868783 bf2f966b 7fcc0148 f709a5d0' +
  148             '3bb5c9b8 899c47ae bb6fb71e 91386409').
  149             replace(/ /g, ''), 'hex'),
  150         G: new Buffer(('04' +
  151             '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' +
  152                  '9c648139 053fb521 f828af60 6b4d3dba' +
  153                  'a14b5e77 efe75928 fe1dc127 a2ffa8de' +
  154                  '3348b3c1 856a429b f97e7e31 c2e5bd66' +
  155             '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' +
  156                  '98f54449 579b4468 17afbd17 273e662c' +
  157                  '97ee7299 5ef42640 c550b901 3fad0761' +
  158                  '353c7086 a272c240 88be9476 9fd16650').
  159             replace(/ /g, ''), 'hex')
  160     }
  161 };
  162 
  163 module.exports = {
  164     info: algInfo,
  165     privInfo: algPrivInfo,
  166     hashAlgs: hashAlgs,
  167     curves: curves
  168 };