RSA Security Projection Television 5.2.2 Manual de usuario Pagina 305

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 376
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 304
Chapter 7 Public-Key Operations 283
Performing Elliptic Curve Operations
You must allocate space to hold the results of Phase 1 and Phase 2. The largest size of
Phase 1 output you can get is one byte larger than twice the field element size. For
Phase 2, the size of the output should be the same as the field element size. (See the
Reference Manual Chapter 2 entry for
AI_EC_DHKeyAgree for details.)
You can get the field element size using Alices elliptic curve parameters. Since you
have the parameters in the
A_EC_PARAMS structure
ecParams
, look at the
fieldElementBits
field, which gives you the required information. A simple
manipulation gives you the field element length in bytes:
Step 4: Phase 1
During this phase, each party computes a private value and a public value. The
private value is secret and currently cannot be accessed though the Crypto-C API. The
public value should be transported to the other party. Note that you will have to
supply a properly initialized random algorithm as the fifth argument to
B_KeyAgreePhase1:
if ((status = B_KeyAgreeInit(alice, (B_KEY_OBJ)NULL_PTR, EC_DH_CHOOSER,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
unsigned int fieldElementLen, maxPhase1Len, maxPhase2Len;
fieldElementLen = (ecParams->fieldElementBits + 7) / 8;
maxPhase1Len = (fieldElementLen * 2);
maxPhase2Len = fieldElementLen;
unsigned char *alicePublicValue = NULL_PTR;
unsigned int alicePublicValueLen;
alicePublicValue = T_malloc(maxPhase1Len);
if ((status = (alicePublicValue == NULL_PTR)) != 0)
break;
if ((status = B_KeyAgreePhase1(alice, alicePublicValue,
&alicePublicValueLen, maxPhase1Len,
randomAlgorithm,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
Vista de pagina 304
1 2 ... 300 301 302 303 304 305 306 307 308 309 310 ... 375 376

Comentarios a estos manuales

Sin comentarios