Browse Source

Signature.h added

pull/93/head
orignal 10 years ago
parent
commit
aaa8e39d68
  1. 1
      Identity.h
  2. 43
      Signature.h
  3. 2
      Win32/i2pd.vcxproj
  4. 1
      build/CMakeLists.txt
  5. 2
      filelist.mk

1
Identity.h

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

43
Signature.h

@ -0,0 +1,43 @@ @@ -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

2
Win32/i2pd.vcxproj

@ -84,6 +84,8 @@ @@ -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">

1
build/CMakeLists.txt

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

2
filelist.mk

@ -11,7 +11,7 @@ H_FILES := CryptoConst.h base64.h NTCPSession.h RouterInfo.h Transports.h \ @@ -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)))

Loading…
Cancel
Save