Algorithms.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace MGModule\DNSManager2\mgLibs\custom\dns\dnssec;
  3. /**
  4. * Get algoritm name using ID
  5. */
  6. class Algorithms
  7. {
  8. public static $algorithms = array(
  9. 1 => 'RSA/MD5',
  10. 2 => 'Diffie-Hellman',
  11. 3 => 'DSA/SHA1',
  12. 5 => 'RSA/SHA-1',
  13. 6 => 'DSA-NSEC3-SHA1',
  14. 7 => 'RSASHA1-NSEC3-SHA1',
  15. 8 => 'RSA/SHA-256',
  16. 10 => 'RSA/SHA-512',
  17. 12 => 'GOST R 34.10-2001',
  18. 13 => 'ECDSA Curve P-256 with SHA-256',
  19. 14 => 'ECDSA Curve P-384 with SHA-384',
  20. 15 => 'RSASHA512',
  21. 16 => 'RSASHA256',
  22. );
  23. /**
  24. *
  25. * @param type $number
  26. * @return string
  27. */
  28. public static function convert($number)
  29. {
  30. if(!isset(self::$algorithms[$number]))
  31. {
  32. return "$number - Unknow algorithm type";
  33. }
  34. return $number.' - '.self::$algorithms[$number];
  35. }
  36. public static function getAlgorithm($number)
  37. {
  38. if(!isset(self::$algorithms[$number]))
  39. {
  40. return "$number - Unknow algorithm type";
  41. }
  42. return self::$algorithms[$number];
  43. }
  44. }