Oh should have mentioned the error is BER decode error On Aug 31, 1:45 pm, Some Guy <[email protected]> wrote: > Hi, I'm trying to load keys from a string then perform operations but > I'm obviously doing it wrong. This is just using sample code from the > Crypto++ wiki except for the key loading which I've changed and is > wrong. Can someone tell me how I should be doing it please? > > Any help is much appreciated, next thing I'm trying is generating the > keys with crypto++ rather than the online generator I was using. > > std::string pub_key = > "AAAAB3NzaC1yc2EAAAABJQAAAIEAofcO32Qko4srylZRXQywJqWt4msjzrilwIntr21mjZM8vQ > 3pTsM/ > GWW+nQzAAGp0JPanYbJN7f3HGwF7z8V51cq41PJKnAwJDayoj5eOEM8iIpgZaoowT > +jfn25Q2+55oEpQz41LdvZoLZ4s58JI30r9byWWlTwen9+JwGFcJ3c=="; > std::string priv_key = "AAAAgEYJ+Jfz9CsLv > +jLYXRYg4ZVe6AuVKxrhfJlKIM2Oi9iQ8df9i/lumvY+HtD" > > "yKY73zKULLSgIbMF9TwcUTdAo2KqKpX > +phAZNXEXjCB14JSXObhkJvm8ak5kdDSj" > "SZIGIRTPueonhvvya > +tzxmvVpQLpxezlMx6LppzPJxJ8tF6tAAAAQQD96+ATzVro" > > "D01/N8ULQNOhCzdpudjtAxFjJWSlt7yhNLMFfXdh7q/ > ihRYIsbEBgI7lmq6ISmFc" > > "HBgfahbXldH/AAAAQQCjSnoBnTvpriqm/L97teWQYXDGxXAZd2k9bYEO/ > v2fGG0k" > > "dWqv9KBzSYcZwF1iurmoyQzLRf09ET0hFU7JZTqJAAAAQBa0// > vmDitumKwJSXXH" > > "kS84LKn8IM9VJ78VosY49A8f1p8FgEb15xwiuKsI2A3w9LGcqi3KDwUAwXl9y9/ > o" > "Yhs"; > > try > { > > RSA::PrivateKey privateKey; > privateKey.Load(StringSource(priv_key,true,NULL).Ref()); > RSA::PublicKey publicKey; > publicKey.Load(StringSource(pub_key,true,NULL).Ref()); > > // Message > string message = "Yoda said, Do or Do Not. There is not try."; > string signature; > > //////////////////////////////////////////////// > // Sign and Encode > RSASS<PSS, SHA1>::Signer signer( privateKey ); > > StringSource( message, true, > new SignerFilter( rng, signer, > new StringSink( signature ) > ) // SignerFilter > ); // StringSource > > //////////////////////////////////////////////// > // Verify and Recover > RSASS<PSS, SHA1>::Verifier verifier( publicKey ); > > StringSource( message+signature, true, > new SignatureVerificationFilter( > verifier, NULL, > SignatureVerificationFilter::THROW_EXCEPTION > ) // SignatureVerificationFilter > ); // StringSource > > cout << "Verified signature on message" << endl; > > } // try > > catch( CryptoPP::Exception& e ) { > std::cerr << "Error: " << e.what() << std::endl; > } > > return 0; > > > > > > > > }
-- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
