Signature.h added

This commit is contained in:
orignal 2014-08-21 11:15:04 -04:00
parent b671de27ce
commit aaa8e39d68
5 changed files with 48 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include <string>
#include "base64.h"
#include "ElGamal.h"
#include "Signature.h"
namespace i2p
{

43
Signature.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef SIGNATURE_H__
#define SIGNATURE_H__
#include <inttypes.h>
#include <cryptopp/dsa.h>
#include "CryptoConst.h"
namespace i2p
{
namespace crypto
{
class Verifier
{
public:
virtual ~Verifier () {};
virtual bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) = 0;
};
class DSAVerifier: public Verifier
{
public:
DSAVerifier (const uint8_t * signingKey)
{
m_PublicKey.Initialize (dsap, dsaq, dsag, CryptoPP::Integer (signingKey, 128));
}
bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature)
{
CryptoPP::DSA::Verifier verifier (m_PublicKey);
return verifier.VerifyMessage (buf, len, signature, 40);
}
private:
CryptoPP::DSA::PublicKey m_PublicKey;
};
}
}
#endif

View File

@ -84,6 +84,8 @@
<ClInclude Include="..\util.h" />
<ClInclude Include="..\SOCKS.h" />
<ClInclude Include="..\I2PTunnel.h" />
<ClInclude Include="..\version.h" />
<ClInclude Include="..\Signature.h" />
<ClInclude Include="Win32Service.h" />
</ItemGroup>
<PropertyGroup Label="Globals">

View File

@ -77,6 +77,7 @@ set ( HEADERS
SOCKS.h
I2PTunnel.h
version.h
Signature.h
)
if (WIN32)

View File

@ -11,7 +11,7 @@ H_FILES := CryptoConst.h base64.h NTCPSession.h RouterInfo.h Transports.h \
RouterContext.h NetDb.h LeaseSet.h Tunnel.h TunnelEndpoint.h TunnelGateway.h \
TransitTunnel.h I2NPProtocol.h Log.h Garlic.h HTTPServer.h Streaming.h Identity.h \
SSU.h util.h Reseed.h DaemonLinux.h SSUData.h i2p.h aes.h SOCKS.h UPnP.h TunnelPool.h \
HTTPProxy.h AddressBook.h Daemon.h I2PTunnel.h version.h
HTTPProxy.h AddressBook.h Daemon.h I2PTunnel.h version.h Signature.h
OBJECTS = $(addprefix obj/, $(notdir $(CPP_FILES:.cpp=.o)))