mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
Signature.h added
This commit is contained in:
parent
b671de27ce
commit
aaa8e39d68
|
@ -6,6 +6,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
#include "ElGamal.h"
|
#include "ElGamal.h"
|
||||||
|
#include "Signature.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
|
|
43
Signature.h
Normal file
43
Signature.h
Normal 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
|
||||||
|
|
|
@ -84,6 +84,8 @@
|
||||||
<ClInclude Include="..\util.h" />
|
<ClInclude Include="..\util.h" />
|
||||||
<ClInclude Include="..\SOCKS.h" />
|
<ClInclude Include="..\SOCKS.h" />
|
||||||
<ClInclude Include="..\I2PTunnel.h" />
|
<ClInclude Include="..\I2PTunnel.h" />
|
||||||
|
<ClInclude Include="..\version.h" />
|
||||||
|
<ClInclude Include="..\Signature.h" />
|
||||||
<ClInclude Include="Win32Service.h" />
|
<ClInclude Include="Win32Service.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
|
|
|
@ -77,6 +77,7 @@ set ( HEADERS
|
||||||
SOCKS.h
|
SOCKS.h
|
||||||
I2PTunnel.h
|
I2PTunnel.h
|
||||||
version.h
|
version.h
|
||||||
|
Signature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
|
@ -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 \
|
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 \
|
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 \
|
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)))
|
OBJECTS = $(addprefix obj/, $(notdir $(CPP_FILES:.cpp=.o)))
|
||||||
|
|
Loading…
Reference in a new issue