| 496 | } |
| 497 | |
| 498 | bool CEC25519PrivateKeyBase::GetPublicKey( CEC25519PublicKeyBase *pPublicKey ) const |
| 499 | { |
| 500 | pPublicKey->Wipe(); |
| 501 | |
| 502 | if ( m_eKeyType == k_ECryptoKeyTypeKeyExchangePrivate ) |
| 503 | { |
| 504 | Assert( pPublicKey->GetKeyType() == k_ECryptoKeyTypeKeyExchangePublic ); |
| 505 | if ( pPublicKey->GetKeyType() != k_ECryptoKeyTypeKeyExchangePublic ) |
| 506 | return false; |
| 507 | } |
| 508 | else if ( m_eKeyType == k_ECryptoKeyTypeSigningPrivate ) |
| 509 | { |
| 510 | Assert( pPublicKey->GetKeyType() == k_ECryptoKeyTypeSigningPublic ); |
| 511 | if ( pPublicKey->GetKeyType() != k_ECryptoKeyTypeSigningPublic ) |
| 512 | return false; |
| 513 | } |
| 514 | else |
| 515 | { |
| 516 | Assert( false ); // impossible, we must be one or the other if valid |
| 517 | return false; |
| 518 | } |
| 519 | |
| 520 | return pPublicKey->SetRawDataWithoutWipingInput( m_publicKey, 32 ); |
| 521 | } |
| 522 | |
| 523 | bool CEC25519PrivateKeyBase::MatchesPublicKey( const CEC25519PublicKeyBase &publicKey ) const |
| 524 | { |