RSA Security Projection Television 5.2.2 Instrukcja Użytkownika Strona 178

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 376
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 177
Message Digests
156 RSA BSAFE Crypto-C Developers Guide
The following example BER-encodes the preceeding sample digest:
To decode BER-encoded information, call
B_DecodeDigestInfo. Simply pass the
addresses you need; Crypto-C will fill the
ITEMs for you:
Note: When you create an RSA digital signature as specified in PKCS #1, the
digestInfo is the data which is encrypted with the RSA private key.
Saving the State of a Digest Algorithm Object
Saved State
The sample program in samples/hashalg/mdigsv.c demonstrates various ways to go
about digesting data. As shown in Creating a Digest on page 152, one could collect
the data to digest in one buffer and present it with one call to
B_DigestUpdate() and a
call to
B_DigestFinal() to retrieve the digest. The DigestDataAll helper function in
mdigsv.c shows this scenario. Alternatively, multiple calls could be made to
#define DIGEST_LEN 20
#define ALG_ID_LEN DIGEST_LEN + 18
ITEM *sha1AlgInfoBER;
unsigned char digestInfoBER[ALG_ID_LEN];
unsigned int digestInfoBERLen;
if ((status = B_GetAlgorithmInfo
((POINTER *)&sha1AlgInfoBER, digester, AI_SHA1_BER)) != 0)
break;
if ((status = B_EncodeDigestInfo
(digestInfoBER, &digestInfoBERLen, ALG_ID_LEN, sha1AlgInfoBER,
digestedData, digestedDataLen)) != 0)
break;
ITEM retrievedAlgorithmID;
ITEM retrievedDigest;
if ((status = B_DecodeDigestInfo
(&retrievedAlgorithmID, &retrievedDigest, digestInfoBER,
digestInfoBERLen)) != 0)
break;
Przeglądanie stron 177
1 2 ... 173 174 175 176 177 178 179 180 181 182 183 ... 375 376

Komentarze do niniejszej Instrukcji

Brak uwag