midrange.com code scratchpad
Name:
Program to list installed ciphers
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
10/25/2007 07:31:21 pm
IP:
Logged
Description:
Program to list installed ciphers
Code:
  1.      H DFTACTGRP(*NO) BNDDIR('QC2LE')
  2.  
  3.      D Crypto_Attr_T   ds                  qualified
  4.      D   algorithm                    2A
  5.      D   key_length                   5I 0
  6.      D   bitflags                     2A
  7.  
  8.      D MMTR_01C8_T     ds                  qualified
  9.      D   numEntries                   5I 0
  10.      D   entries                      6A   dim(100)
  11.  
  12.      D MMTR_Template_T...
  13.      D                 ds                  qualified based(Template_Only)
  14.      D  Template_Size                10I 0
  15.      D  Bytes_Used                   10I 0
  16.      D  Crypto_Attrs                602A
  17.  
  18.      D MMTR_CRYTPOGRAPHY...
  19.      D                 C                   456
  20.  
  21.      D GetAlgName      PR            45A   varying
  22.      D   Algorithm                    2A   const
  23.  
  24.      D matmatr         pr                  extproc('matmatr')
  25.      D   receiver                          likeds(MMTR_Template_T)
  26.      D   attr                         5I 0 value
  27.  
  28.      D r               ds                  likeds(MMTR_TEMPLATE_T)
  29.      D x               s             10I 0
  30.      D msg             s             52A
  31.  
  32.       /free
  33.  
  34.         r.Template_Size = %size(r);
  35.         matmatr(r: MMTR_CRYTPOGRAPHY);
  36.         MMTR_01C8_T = r.Crypto_Attrs;
  37.  
  38.         for x = 1 to MMTR_01C8_T.numEntries;
  39.            Crypto_Attr_T = MMTR_01C8_T.entries(x);
  40.            msg = %char(Crypto_Attr_T.key_length) + '-bit ' +
  41.                  GetAlgName(Crypto_Attr_T.algorithm);
  42.            dsply msg;
  43.         endfor;
  44.  
  45.         *inlr = *on;
  46.  
  47.       /end-free
  48.  
  49.  
  50.       *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  51.       * GetAlgName():  Get Algorithm Name
  52.       *
  53.       *   Algorithm -- Algorithm returned by MATMATR MI function
  54.       *
  55.       * Returns a human-readable algorithm name
  56.       *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  57.      P GetAlgName      B
  58.      D GetAlgName      PI            45A   varying
  59.      D   Algorithm                    2A   const
  60.       /free
  61.  
  62.           select;
  63.           when       Algorithm = x'0001';
  64.              return 'MAC - Message Authentication Code';
  65.  
  66.           when       Algorithm = x'0002';
  67.              return 'MD5';
  68.  
  69.           when       Algorithm = x'0003';
  70.              return 'SHA-1 - Secure Hash Algorithm';
  71.  
  72.           when       Algorithm = x'0004';
  73.              return 'DES (one-way) - Data Encryption Standard';
  74.  
  75.           when       Algorithm = x'0005';
  76.              return 'DES (two-way) - Data Encryption Standard';
  77.  
  78.           when       Algorithm = x'0006';
  79.              return 'RC4';
  80.  
  81.           when       Algorithm = x'0007';
  82.              return 'RC5';
  83.  
  84.           when       Algorithm = x'0008';
  85.              return 'DESX';
  86.  
  87.           when       Algorithm = x'0009';
  88.              return '3DES - Triple DES';
  89.  
  90.           when       Algorithm = x'000A';
  91.              return 'DSA - Digital Signature Algorithm';
  92.  
  93.           when       Algorithm = x'000B';
  94.              return 'RSA - Rivest/Shamir/Adleman';
  95.  
  96.           when       Algorithm = x'000C';
  97.              return 'Diffie-Hellman';
  98.  
  99.           when       Algorithm = x'000D';
  100.              return 'CDMF - Commercial Data Masking Facility';
  101.  
  102.           when       Algorithm = x'000E';
  103.              return 'RC2';
  104.  
  105.           when       Algorithm = x'000F';
  106.              return 'AES - Advanced Encryption Standard';
  107.  
  108.           other;
  109.              return 'Unknown';
  110.           endsl;
  111.  
  112.       /end-free
  113.      P                 E
© 2004-2019 by midrange.com generated in 0.006s valid xhtml & css