Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 12th, 2012  |  syntax: None  |  size: 15.48 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --- php-5.3.8/ext/openssl/openssl.c 2011-07-25 05:42:53.000000000 -0600
  2. +++ php-5.3.8/ext/openssl/openssl.c 2011-12-21 09:15:38.000000000 -0700
  3. @@ -372,11 +372,40 @@
  4.      ZEND_ARG_INFO(0, length)
  5.      ZEND_ARG_INFO(1, result_is_strong)
  6.  ZEND_END_ARG_INFO()
  7. +
  8. +ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_spki_new, 0, 0, 2)
  9. +    ZEND_ARG_INFO(0, privkey)
  10. +    ZEND_ARG_INFO(0, challenge)
  11. +    ZEND_ARG_INFO(0, algo)
  12. +ZEND_END_ARG_INFO()
  13. +
  14. +ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_verify, 0)
  15. +    ZEND_ARG_INFO(0, spki)
  16. +ZEND_END_ARG_INFO()
  17. +
  18. +ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_export, 0)
  19. +    ZEND_ARG_INFO(0, spki)
  20. +ZEND_END_ARG_INFO()
  21. +
  22. +ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_export_challenge, 0)
  23. +    ZEND_ARG_INFO(0, spki)
  24. +ZEND_END_ARG_INFO()
  25. +
  26. +ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_details, 0)
  27. +    ZEND_ARG_INFO(0, spki)
  28. +ZEND_END_ARG_INFO()
  29.  /* }}} */
  30.  
  31.  /* {{{ openssl_functions[]
  32.   */
  33.  const zend_function_entry openssl_functions[] = {
  34. +/* spki functions */
  35. +       PHP_FE(openssl_spki_new, arginfo_openssl_spki_new)
  36. +       PHP_FE(openssl_spki_verify, arginfo_openssl_spki_verify)
  37. +       PHP_FE(openssl_spki_export, arginfo_openssl_spki_export)
  38. + PHP_FE(openssl_spki_export_challenge, arginfo_openssl_spki_export_challenge)
  39. + PHP_FE(openssl_spki_details,  arginfo_openssl_spki_details)
  40. +
  41.  /* public/private key functions */
  42.         PHP_FE(openssl_pkey_free,                       arginfo_openssl_pkey_free)
  43.         PHP_FE(openssl_pkey_new,                        arginfo_openssl_pkey_new)
  44. @@ -1252,6 +1281,291 @@
  45.  }
  46.  /* }}} */
  47.  
  48. +/* {{{ proto string openssl_spki_new(mixed zpkey, string challenge [, string algo='sha256'])
  49. +   Creates new private key (or uses existing) and creates a new spki cert
  50. +   outputting results to var */
  51. +PHP_FUNCTION(openssl_spki_new)
  52. +{
  53. + zval * zpkey = NULL;
  54. + EVP_PKEY * pkey = NULL;
  55. + NETSCAPE_SPKI *spki=NULL;
  56. + int challenge_len, algo_len;
  57. + char * challenge, * spkstr, *algo="sha256";
  58. + long keyresource = -1;
  59. + const char *spkac = "SPKAC=";
  60. +
  61. + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &zpkey, &challenge, &challenge_len, &algo, &algo_len) == FAILURE) {
  62. +  return;
  63. + }
  64. + RETVAL_FALSE;
  65. +
  66. + pkey = php_openssl_evp_from_zval(&zpkey, 0, challenge, 1, &keyresource TSRMLS_CC);
  67. +
  68. + if (pkey == NULL) {
  69. +  goto cleanup;
  70. + }
  71. +
  72. + if ((spki = NETSCAPE_SPKI_new()) == NULL) {
  73. +  goto cleanup;
  74. + }
  75. +
  76. + if (challenge) {
  77. +  ASN1_STRING_set(spki->spkac->challenge, challenge, (int)strlen(challenge));
  78. + }
  79. +
  80. + if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) {
  81. +  goto cleanup;
  82. + }
  83. +
  84. + if (strcmp(algo, "md5")==0){
  85. +  if (!NETSCAPE_SPKI_sign(spki, pkey, EVP_md5())) {
  86. +   goto cleanup;
  87. +  }
  88. + } else if(strcmp(algo, "sha1")==0){
  89. +  if (!NETSCAPE_SPKI_sign(spki, pkey, EVP_sha1())) {
  90. +   goto cleanup;
  91. +  }
  92. + } else if(strcmp(algo, "sha256")==0){
  93. +  if (!NETSCAPE_SPKI_sign(spki, pkey, EVP_sha256())) {
  94. +   goto cleanup;
  95. +  }
  96. + } else if (strcmp(algo, "sha512")==0){
  97. +  if (!NETSCAPE_SPKI_sign(spki, pkey, EVP_sha512())) {
  98. +   goto cleanup;
  99. +  }
  100. + }
  101. +
  102. + spkstr = NETSCAPE_SPKI_b64_encode(spki);
  103. + if (!spkstr){
  104. +  goto cleanup;
  105. + }
  106. +
  107. + char * s = malloc(snprintf(NULL, 0, "%s%s", spkac, spkstr));
  108. + sprintf(s, "%s%s", spkac, spkstr);
  109. +
  110. + if (strlen(s)<=0) {
  111. +  goto cleanup;
  112. + }
  113. + RETURN_STRING(s, 1);
  114. +
  115. +cleanup:
  116. + if (keyresource == -1 && spki) {
  117. +  NETSCAPE_SPKI_free(spki);
  118. + }
  119. + if (keyresource == -1 && pkey) {
  120. +  EVP_PKEY_free(pkey);
  121. + }
  122. + if (keyresource == -1 && s) {
  123. +  free(s);
  124. + }
  125. + RETURN_NULL();
  126. +}
  127. +/* }}} */
  128. +
  129. +/* {{{ proto bool openssl_spki_verify(string spki)
  130. +   Verifies spki returns boolean */
  131. +PHP_FUNCTION(openssl_spki_verify)
  132. +{
  133. + int spkstr_len, i, x=0;
  134. + char *spkstr = NULL;
  135. + EVP_PKEY *pkey = NULL;
  136. + NETSCAPE_SPKI *spki = NULL;
  137. +
  138. + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &spkstr, &spkstr_len) == FAILURE) {
  139. +  return;
  140. + }
  141. +
  142. + if (!spkstr) {
  143. +  goto cleanup;
  144. + }
  145. +
  146. + char * spkstr_cleaned = malloc(strlen(spkstr));
  147. + openssl_spki_cleanup(spkstr, spkstr_cleaned);
  148. +
  149. + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned));
  150. + if (!spki) {
  151. +  goto cleanup;
  152. + }
  153. +
  154. + pkey = X509_PUBKEY_get(spki->spkac->pubkey);
  155. + if (pkey == NULL) {
  156. +  goto cleanup;
  157. + }
  158. +
  159. + i = NETSCAPE_SPKI_verify(spki, pkey);
  160. +
  161. + if (i > 0) {
  162. +  x = 1;
  163. + }
  164. + goto cleanup;
  165. +
  166. +cleanup:
  167. + if (spki) {
  168. +  NETSCAPE_SPKI_free(spki);
  169. + }
  170. + if (pkey) {
  171. +  EVP_PKEY_free(pkey);
  172. + }
  173. + RETURN_BOOL(x);
  174. +}
  175. +/* }}} */
  176. +
  177. +/* {{{ proto string openssl_spki_export(string spki)
  178. +   Exports public key from existing spki to var */
  179. +PHP_FUNCTION(openssl_spki_export)
  180. +{
  181. + int spkstr_len;
  182. + EVP_PKEY *pkey = NULL;
  183. + NETSCAPE_SPKI *spki = NULL;
  184. + BIO *out = BIO_new(BIO_s_mem());
  185. + BUF_MEM *bio_buf;
  186. + char *spkstr;
  187. +
  188. + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &spkstr, &spkstr_len) == FAILURE) {
  189. +  goto cleanup;
  190. + }
  191. +
  192. + if (!spkstr) {
  193. +  goto cleanup;
  194. + }
  195. +
  196. + char * spkstr_cleaned = malloc(strlen(spkstr));
  197. + openssl_spki_cleanup(spkstr, spkstr_cleaned);
  198. +
  199. + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned));
  200. + if (!spki) {
  201. +  goto cleanup;
  202. + }
  203. +
  204. + pkey = X509_PUBKEY_get(spki->spkac->pubkey);
  205. + if (!pkey) {
  206. +  goto cleanup;
  207. + }
  208. +
  209. + PEM_write_bio_PUBKEY(out, pkey);
  210. + BIO_get_mem_ptr(out, &bio_buf);
  211. +
  212. + if ((!bio_buf->data)&&(bio_buf->length<=0)) {
  213. +  goto cleanup;
  214. + }
  215. +
  216. + char * s = malloc(bio_buf->length);
  217. + BIO_read(out, s, bio_buf->length);
  218. + RETURN_STRING(s, 1);
  219. +
  220. +cleanup:
  221. + if (spki) {
  222. +  NETSCAPE_SPKI_free(spki);
  223. + }
  224. + if (out) {
  225. +  BIO_free_all(out);
  226. + }
  227. + if (pkey) {
  228. +  EVP_PKEY_free(pkey);
  229. + }
  230. +}
  231. +/* }}} */
  232. +
  233. +/* {{{ proto string openssl_spki_export_challenge(string spki)
  234. +   Exports spkac challenge from existing spki to var */
  235. +PHP_FUNCTION(openssl_spki_export_challenge)
  236. +{
  237. + int spkstr_len;
  238. + NETSCAPE_SPKI *spki = NULL;
  239. + char *spkstr;
  240. +
  241. + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &spkstr, &spkstr_len) == FAILURE) {
  242. +  goto cleanup;
  243. + }
  244. +
  245. + if (!spkstr) {
  246. +  goto cleanup;
  247. + }
  248. +
  249. + char * spkstr_cleaned = malloc(strlen(spkstr));
  250. + openssl_spki_cleanup(spkstr, spkstr_cleaned);
  251. +
  252. + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned));
  253. + if (!spki) {
  254. +  goto cleanup;
  255. + }
  256. +
  257. + RETURN_STRING(ASN1_STRING_data(spki->spkac->challenge), 1);
  258. +
  259. +cleanup:
  260. + if (spki) {
  261. +  NETSCAPE_SPKI_free(spki);
  262. + }
  263. +}
  264. +/* }}} */
  265. +
  266. +/* {{{ proto string openssl_spki_details(string spki)
  267. +   Provides details from existing spki to var */
  268. +PHP_FUNCTION(openssl_spki_details)
  269. +{
  270. + int spkstr_len;
  271. + NETSCAPE_SPKI *spki = NULL;
  272. + BIO *out = BIO_new(BIO_s_mem());
  273. + BUF_MEM *bio_buf;
  274. + zval *zout;
  275. + char *spkstr;
  276. +
  277. + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &spkstr, &spkstr_len) == FAILURE) {
  278. +  return;
  279. + }
  280. + RETVAL_FALSE;
  281. +
  282. + if (!spkstr) {
  283. +  goto cleanup;
  284. + }
  285. +
  286. + char * spkstr_cleaned = malloc(strlen(spkstr));
  287. + openssl_spki_cleanup(spkstr, spkstr_cleaned);
  288. +
  289. + spki = NETSCAPE_SPKI_b64_decode(spkstr_cleaned, strlen(spkstr_cleaned));
  290. + if (!spki) {
  291. +  goto cleanup;
  292. + }
  293. +
  294. + NETSCAPE_SPKI_print(out, spki);
  295. + BIO_get_mem_ptr(out, &bio_buf);
  296. +
  297. + if ((!bio_buf->data)&&(bio_buf->length<=0)) {
  298. +  goto cleanup;
  299. + }
  300. +
  301. + char * s = malloc(bio_buf->length);
  302. + BIO_read(out, s, bio_buf->length);
  303. + RETURN_STRING(s, 1);
  304. +
  305. +cleanup:
  306. + if (spki) {
  307. +  NETSCAPE_SPKI_free(spki);
  308. + }
  309. + BIO_free_all(out);
  310. +}
  311. +/* }}} */
  312. +
  313. +/* {{{ proto int openssl_spki_cleanup(const char *src, char *results)
  314. +  This will help remove new line chars in the SPKAC sent from the
  315. +  browser */
  316. +int openssl_spki_cleanup(const char *src, char *dest)
  317. +{
  318. +    int removed=0;
  319. +
  320. +    while (*src) {
  321. +        if (*src!='\n'&&*src!='\r') {
  322. +            *dest++=*src;
  323. +        } else {
  324. +            ++removed;
  325. +        }
  326. +        ++src;
  327. +    }
  328. +    *dest=0;
  329. +    return removed;
  330. +}
  331. +/* }}} */
  332. +
  333.  /* {{{ proto bool openssl_x509_export(mixed x509, string &out [, bool notext = true])
  334.     Exports a CERT to file or a var */
  335.  PHP_FUNCTION(openssl_x509_export)
  336. --- php-5.3.8/ext/openssl/php_openssl.h 2010-12-31 19:19:59.000000000 -0700
  337. +++ php-5.3.8/ext/openssl/php_openssl.h 2011-12-21 09:15:38.000000000 -0700
  338. @@ -74,6 +74,12 @@
  339.  PHP_FUNCTION(openssl_csr_sign);
  340.  PHP_FUNCTION(openssl_csr_get_subject);
  341.  PHP_FUNCTION(openssl_csr_get_public_key);
  342. +
  343. +PHP_FUNCTION(openssl_spki_new);
  344. +PHP_FUNCTION(openssl_spki_verify);
  345. +PHP_FUNCTION(openssl_spki_export);
  346. +PHP_FUNCTION(openssl_spki_export_challenge);
  347. +PHP_FUNCTION(openssl_spki_details);
  348.  #else
  349.  
  350.  #define phpext_openssl_ptr NULL
  351. --- php-5.3.8/ext/openssl/tests/026.phpt 1969-12-31 17:00:00.000000000 -0700
  352. +++ php-5.3.8/ext/openssl/tests/026.phpt 2011-12-21 12:45:39.000000000 -0700
  353. @@ -0,0 +1,208 @@
  354. +--TEST--
  355. +openssl_spki_new(), openssl_spki_verify(), openssl_spki_export(), openssl_spki_export_challenge(), openssl_spki_details()
  356. +--SKIPIF--
  357. +<?php
  358. +if (!extension_loaded("openssl")) die("skip");
  359. +if (!@openssl_pkey_new()) die("skip cannot create private key");
  360. +?>
  361. +--FILE--
  362. +<?php
  363. +
  364. +echo "Creating private key\n";
  365. +$key = openssl_pkey_new();
  366. +if ($key === false)
  367. + die("failed to create private key\n");
  368. +
  369. +echo "Creating new SPKAC with defaults\n";
  370. +if (!function_exists("openssl_spki_new"))
  371. + die("openssl_spki_new() does not exist\n");
  372. +
  373. +$spki = openssl_spki_new($key, "sample_challenge_string");
  374. +if ($spki === false)
  375. + die("could not create spkac\n");
  376. +
  377. +echo "Verifying SPKAC using defaults\n";
  378. +if (!function_exists("openssl_spki_verify"))
  379. + die("openssl_spki_verify() does not exist\n");
  380. +
  381. +$a = openssl_spki_verify(preg_replace("/SPKAC=/", "", $spki));
  382. +if ($a === false)
  383. + die("could not verify spkac\n");
  384. +
  385. +echo "Exporting challenge using defaults\n";
  386. +if (!function_exists("openssl_spki_export_challenge"))
  387. + die("openssl_spki_export_challenge() does not exist\n");
  388. +
  389. +$b = openssl_spki_export_challenge(preg_replace("/SPKAC=/", "", $spki));
  390. +if ($b !== "sample_challenge_string")
  391. + die("could not verify challenge string from spkac\n");
  392. +
  393. +echo "Exporting public key from SPKAC using defaults\n";
  394. +if (!function_exists("openssl_spki_export"))
  395. + die("openssl_spki_export() does not exist\n");
  396. +
  397. +$c = openssl_spki_export(preg_replace("/SPKAC=/", '', $spki));
  398. +if ($c === "")
  399. + die("could not export public key from spkac\n");
  400. +
  401. +echo "Generating details of SPKAC structure using defaults\n";
  402. +if (!function_exists("openssl_spki_details"))
  403. + die("openssl_spki_details() does not exist\n");
  404. +
  405. +$d = openssl_spki_details(preg_replace('/SPKAC=/', '', $spki));
  406. +if ($d === "")
  407. + die("could not obtain details from spkac\n");
  408. +
  409. +unset($spki, $a, $b, $c, $d);
  410. +
  411. +echo "Creating new SPKAC using md5 signature\n";
  412. +if (!function_exists("openssl_spki_new"))
  413. + die("openssl_spki_new() does not exist\n");
  414. +
  415. +$spki = openssl_spki_new($key, "sample_challenge_string", "md5");
  416. +if ($spki === false)
  417. + die("could not create spkac\n");
  418. +
  419. +echo "Verifying SPKAC using md5 signature\n";
  420. +if (!function_exists("openssl_spki_verify"))
  421. + die("openssl_spki_verify() does not exist\n");
  422. +
  423. +$a = openssl_spki_verify(preg_replace("/SPKAC=/", "", $spki));
  424. +if ($a === false)
  425. + die("could not verify spkac\n");
  426. +
  427. +echo "Exporting challenge using md5 signature\n";
  428. +if (!function_exists("openssl_spki_export_challenge"))
  429. + die("openssl_spki_export_challenge() does not exist\n");
  430. +
  431. +$b = openssl_spki_export_challenge(preg_replace("/SPKAC=/", "", $spki));
  432. +if ($b !== "sample_challenge_string")
  433. + die("could not verify challenge string from spkac\n");
  434. +
  435. +echo "Exporting public key from SPKAC using md5 signature\n";
  436. +if (!function_exists("openssl_spki_export"))
  437. + die("openssl_spki_export() does not exist\n");
  438. +
  439. +$c = openssl_spki_export(preg_replace("/SPKAC=/", '', $spki));
  440. +if ($c === "")
  441. + die("could not export public key from spkac\n");
  442. +
  443. +echo "Generating details of SPKAC structure using md5 signature\n";
  444. +if (!function_exists("openssl_spki_details"))
  445. + die("openssl_spki_details() does not exist\n");
  446. +
  447. +$d = openssl_spki_details(preg_replace('/SPKAC=/', '', $spki));
  448. +if ($d === "")
  449. + die("could not obtain details from spkac\n");
  450. +
  451. +unset($spki, $a, $b, $c, $d);
  452. +
  453. +echo "Creating new SPKAC using sha1 signature\n";
  454. +if (!function_exists("openssl_spki_new"))
  455. + die("openssl_spki_new() does not exist\n");
  456. +
  457. +$spki = openssl_spki_new($key, "sample_challenge_string", "sha1");
  458. +if ($spki === false)
  459. + die("could not create spkac\n");
  460. +
  461. +echo "Verifying SPKAC using sha1 signature\n";
  462. +if (!function_exists("openssl_spki_verify"))
  463. + die("openssl_spki_verify() does not exist\n");
  464. +
  465. +$a = openssl_spki_verify(preg_replace("/SPKAC=/", "", $spki));
  466. +if ($a === false)
  467. + die("could not verify spkac\n");
  468. +
  469. +echo "Exporting challenge using sha1 signature\n";
  470. +if (!function_exists("openssl_spki_export_challenge"))
  471. + die("openssl_spki_export_challenge() does not exist\n");
  472. +
  473. +$b = openssl_spki_export_challenge(preg_replace("/SPKAC=/", "", $spki));
  474. +if ($b !== "sample_challenge_string")
  475. + die("could not verify challenge string from spkac\n");
  476. +
  477. +echo "Exporting public key from SPKAC using sha1 signature\n";
  478. +if (!function_exists("openssl_spki_export"))
  479. + die("openssl_spki_export() does not exist\n");
  480. +
  481. +$c = openssl_spki_export(preg_replace("/SPKAC=/", '', $spki));
  482. +if ($c === "")
  483. + die("could not export public key from spkac\n");
  484. +
  485. +echo "Generating details of SPKAC structure using sha1 signature\n";
  486. +if (!function_exists("openssl_spki_details"))
  487. + die("openssl_spki_details() does not exist\n");
  488. +
  489. +$d = openssl_spki_details(preg_replace('/SPKAC=/', '', $spki));
  490. +if ($d === "")
  491. + die("could not obtain details from spkac\n");
  492. +
  493. +unset($spki, $a, $b, $c, $d);
  494. +
  495. +echo "Creating new SPKAC using sha512 signature\n";
  496. +if (!function_exists("openssl_spki_new"))
  497. + die("openssl_spki_new() does not exist\n");
  498. +
  499. +$spki = openssl_spki_new($key, "sample_challenge_string", "sha512");
  500. +if ($spki === false)
  501. + die("could not create spkac\n");
  502. +
  503. +echo "Verifying SPKAC using sha512 signature\n";
  504. +if (!function_exists("openssl_spki_verify"))
  505. + die("openssl_spki_verify() does not exist\n");
  506. +
  507. +$a = openssl_spki_verify(preg_replace("/SPKAC=/", "", $spki));
  508. +if ($a === false)
  509. + die("could not verify spkac\n");
  510. +
  511. +echo "Exporting challenge using sha512 signature\n";
  512. +if (!function_exists("openssl_spki_export_challenge"))
  513. + die("openssl_spki_export_challenge() does not exist\n");
  514. +
  515. +$b = openssl_spki_export_challenge(preg_replace("/SPKAC=/", "", $spki));
  516. +if ($b !== "sample_challenge_string")
  517. + die("could not verify challenge string from spkac\n");
  518. +
  519. +echo "Exporting public key from SPKAC using sha512 signature\n";
  520. +if (!function_exists("openssl_spki_export"))
  521. + die("openssl_spki_export() does not exist\n");
  522. +
  523. +$c = openssl_spki_export(preg_replace("/SPKAC=/", '', $spki));
  524. +if ($c === "")
  525. + die("could not export public key from spkac\n");
  526. +
  527. +echo "Generating details of SPKAC structure using sha512 signature\n";
  528. +if (!function_exists("openssl_spki_details"))
  529. + die("openssl_spki_details() does not exist\n");
  530. +
  531. +$d = openssl_spki_details(preg_replace('/SPKAC=/', '', $spki));
  532. +if ($d === "")
  533. + die("could not obtain details from spkac\n");
  534. +
  535. +echo "OK!\n";
  536. +
  537. +openssl_free_key($key);
  538. +?>
  539. +--EXPECT--
  540. +Creating private key
  541. +Creating new SPKAC with defaults
  542. +Verifying SPKAC using defaults
  543. +Exporting challenge using defaults
  544. +Exporting public key from SPKAC using defaults
  545. +Generating details of SPKAC structure using defaults
  546. +Creating new SPKAC using md5 signature
  547. +Verifying SPKAC using md5 signature
  548. +Exporting challenge using md5 signature
  549. +Exporting public key from SPKAC using md5 signature
  550. +Generating details of SPKAC structure using md5 signature
  551. +Creating new SPKAC using sha1 signature
  552. +Verifying SPKAC using sha1 signature
  553. +Exporting challenge using sha1 signature
  554. +Exporting public key from SPKAC using sha1 signature
  555. +Generating details of SPKAC structure using sha1 signature
  556. +Creating new SPKAC using sha512 signature
  557. +Verifying SPKAC using sha512 signature
  558. +Exporting challenge using sha512 signature
  559. +Exporting public key from SPKAC using sha512 signature
  560. +Generating details of SPKAC structure using sha512 signature
  561. +OK!