RSA Security Projection Television 5.2.2 Manual de usuario Pagina 45

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 376
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 44
Chapter 2 Quick Start 23
Introductory Example
static char dataToEncrypt[] = "Encrypt this sentence.";
unsigned char *encryptedData = NULL_PTR;
unsigned int dataToEncryptLen, encryptedDataLen;
unsigned int outputLenUpdate, outputLenFinal;
int status;
do {
dataToEncryptLen = strlen (dataToEncrypt) + 1;
/* Step 1: Create an algorithm object. */
if ((status = B_CreateAlgorithmObject (&rc4Encrypter)) != 0)
break;
/* Step 2: Set the algorithm to a type that does rc4 encryption.
AI_RC4 will do. */
if ((status = B_SetAlgorithmInfo
(rc4Encrypter, AI_RC4, NULL_PTR)) != 0)
break;
/* Step 3a: Create a key object. */
if ((status = B_CreateKeyObject (&rc4Key)) != 0)
break;
/* Step 3b: Set the key object with the 10-byte key. */
rc4KeyItem.data = rc4KeyData;
rc4KeyItem.len = rc4KeyDataLen;
if ((status = B_SetKeyInfo
(rc4Key, KI_Item, (POINTER)&rc4KeyItem)) != 0)
break;
if (rc4KeyItem.data != NULL_PTR) {
T_memset (rc4KeyItem.data, 0, rc4KeyItem.len);
T_free (rc4KeyItem.data);
rc4KeyItem.data = NULL_PTR;
rc4KeyItem.len = 0;
}
/* Step 3: Init */
if ((status = B_EncryptInit
(rc4Encrypter, rc4Key, DEMO_ALGORITHM_CHOOSER,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
Vista de pagina 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 375 376

Comentarios a estos manuales

Sin comentarios