RSA Security Projection Television 5.2.2 Uživatelský manuál Strana 49

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 376
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 48
Chapter 2 Quick Start 27
Decrypting the Introductory Example
Step 3b: Setting the Key Object
We need to fill our key with the same 10 bytes of data we used for encryption. We
must make sure that we use the same key as we used to encrypt. For our sample
application, we can simply re-create the key data we had before:
Now we can complete the call to
B_SetKeyInfo:
Step 4: Update
Here, we must set the buffer that will store the decrypted data; for the RC4 cipher, it
should be the same size as the encrypted datas buffer:
static unsigned char rc4KeyData[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10
};
if ((status = B_SetKeyInfo
(rc4Key, KI_Item, (POINTER)&rc4KeyData)) != 0)
break;
unsigned char *decryptedData = NULL_PTR;
decryptedData = T_malloc (encryptedDataLen);
if ((status = (decryptedData == NULL_PTR)) != 0)
break;
if ((status = B_DecryptUpdate
(rc4Decrypter, decryptedData, &decryptedLenUpdate,
encryptedDataLenTotal, encryptedData, outputLenTotal,
(B_ALGORITHM_OBJ)NULL_PTR,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
Zobrazit stránku 48
1 2 ... 44 45 46 47 48 49 50 51 52 53 54 ... 375 376

Komentáře k této Příručce

Žádné komentáře