| 657 | } |
| 658 | |
| 659 | bool CECSigningPublicKey::SetFromOpenSSHAuthorizedKeys( const char *pchData, size_t cbData ) |
| 660 | { |
| 661 | Wipe(); |
| 662 | |
| 663 | // Gah, we need to make a copy to '\0'-terminate it, to make parsing below easier |
| 664 | CAutoWipeBuffer bufText( int( cbData + 8 ) ); |
| 665 | bufText.Put( pchData, int(cbData) ); |
| 666 | bufText.PutChar(0); |
| 667 | pchData = (const char *)bufText.Base(); |
| 668 | |
| 669 | int idxStart = -1, idxEnd = -1; |
| 670 | sscanf( pchData, "ssh-ed25519 %nAAAA%*s%n", &idxStart, &idxEnd ); |
| 671 | if ( idxStart <= 0 || idxEnd <= idxStart ) |
| 672 | return false; |
| 673 | |
| 674 | CAutoWipeBuffer bufBinary; |
| 675 | if ( !CCrypto::DecodeBase64ToBuf( pchData + idxStart, idxEnd-idxStart, bufBinary ) ) |
| 676 | return false; |
| 677 | |
| 678 | uint8 pubKey[ 32 ]; |
| 679 | if ( !BParseOpenSSHBinaryEd25519Public( bufBinary, pubKey ) ) |
| 680 | return false; |
| 681 | return SetRawDataAndWipeInput( pubKey, 32 ); |
| 682 | } |
| 683 | |
| 684 | void CCrypto::GenerateKeyExchangeKeyPair( CECKeyExchangePublicKey *pPublicKey, CECKeyExchangePrivateKey *pPrivateKey ) |
| 685 | { |
no test coverage detected