Read OpenSSL format public header
| 392 | |
| 393 | // Read OpenSSL format public header |
| 394 | void RSA_Public_Decoder::ReadHeaderOpenSSL() |
| 395 | { |
| 396 | byte b = source_.next(); // peek |
| 397 | source_.prev(); |
| 398 | |
| 399 | if (b != INTEGER) { // have OpenSSL public format |
| 400 | GetSequence(); |
| 401 | b = source_.next(); |
| 402 | if (b != OBJECT_IDENTIFIER) { |
| 403 | source_.SetError(OBJECT_ID_E); |
| 404 | return; |
| 405 | } |
| 406 | |
| 407 | word32 len = GetLength(source_); |
| 408 | source_.advance(len); |
| 409 | |
| 410 | b = source_.next(); |
| 411 | if (b == TAG_NULL) { // could have NULL tag and 0 terminator, may not |
| 412 | b = source_.next(); |
| 413 | if (b != 0) { |
| 414 | source_.SetError(EXPECT_0_E); |
| 415 | return; |
| 416 | } |
| 417 | } |
| 418 | else |
| 419 | source_.prev(); // put back |
| 420 | |
| 421 | b = source_.next(); |
| 422 | if (b != BIT_STRING) { |
| 423 | source_.SetError(BIT_STR_E); |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | len = GetLength(source_); |
| 428 | b = source_.next(); |
| 429 | if (b != 0) // could have 0 |
| 430 | source_.prev(); // put back |
| 431 | |
| 432 | GetSequence(); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | |
| 437 | void RSA_Public_Decoder::ReadHeader() |