RSA Security Projection Television 5.2.2 Instrukcja Użytkownika Strona 341

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 376
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 340
Chapter 9 Putting It All Together: An X9.31 Example 319
The X9.31 Sample Program
/* ======================================================== */
printf ("\n Generating a Keypair \n");
printf (" ==================== \n");
if ((status = B_CreateAlgorithmObject (&keypairGenerator)) != 0)
break;
keygenParams.modulusBits = RSA_MODULUS_BITS;
keygenParams.publicExponent.data = f4Data;
keygenParams.publicExponent.len = 3;
/* For this example, AI_RSAStrongKeyGen is used, rather than
AI_RSAKeyGen. AI_RSAStrongKeyGen allows you to
specify the parameters for generating an RSA public/private
key pair as defined in PKCS#1. The moduli generated
are in conformance with the strength criteria of the ANSI
X9.31 standard.*/
if ((status = B_SetAlgorithmInfo (keypairGenerator, AI_RSAStrongKeyGen,
(POINTER)&keygenParams)) != 0)
break;
if ((status = B_GenerateInit
(keypairGenerator, X931_SAMPLE_CHOOSER,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
if ((status = B_CreateKeyObject (&publicKey)) != 0)
break;
if ((status = B_CreateKeyObject (&privateKey)) != 0)
break;
/* generalFlag is for the surrender function */
generalFlag = 0;
if ((status = B_GenerateKeypair
(keypairGenerator, publicKey, privateKey,
randomAlgorithm, &generalSurrenderContext)) != 0)
break;
Przeglądanie stron 340
1 2 ... 336 337 338 339 340 341 342 343 344 345 346 ... 375 376

Komentarze do niniejszej Instrukcji

Brak uwag