RSA Security Projection Television 5.2.2 Instrukcja Użytkownika Strona 46

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 376
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 45
Introductory Example
24 RSA BSAFE Crypto-C Developers Guide
/* Step 4: Update */
encryptedData = T_malloc (dataToEncryptLen);
if ((status = (encryptedData == NULL_PTR)) != 0)
break;
if ((status = B_EncryptUpdate
(rc4Encrypter, encryptedData, &outputLenUpdate,
dataToEncryptLen, (unsigned char *)dataToEncrypt,
dataToEncryptLen, (B_ALGORITHM_OBJ)NULL_PTR,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
/* Step 5: Final */
if ((status = B_EncryptFinal
(rc4Encrypter, encryptedData + outputLenUpdate,
&outputLenFinal, dataToEncryptLen - outputLenUpdate,
(B_ALGORITHM_OBJ)NULL_PTR,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
encryptedDataLen = outputLenUpdate + outputLenFinal;
printf ("Encrypted data (%u bytes):\n", encryptedDataLen);
PrintBuf (encryptedData, encryptedDataLen);
} while (0);
/* Done with the key and algorithm objects, so destroy them. */
B_DestroyKeyObject (&rc4Key);
B_DestroyAlgorithmObject (&rc4Encrypter);
/* Free up any memory allocated, save it to a file or print it out first
if you need to save it. */
if (rc4KeyItem.data != NULL_PTR) {
T_memset (rc4KeyItem.data, 0, rc4KeyItem.len);
T_free (rc4KeyItem.data);
rc4KeyItem.data = NULL_PTR;
rc4KeyItem.len = 0;
}
Przeglądanie stron 45
1 2 ... 41 42 43 44 45 46 47 48 49 50 51 ... 375 376

Komentarze do niniejszej Instrukcji

Brak uwag