Browse Source

b33address

pull/61/head
orignal 5 years ago
parent
commit
25b1166fd9
  1. 3
      .gitignore
  2. 7
      Makefile
  3. 30
      b33address.cpp
  4. 2
      common/key.hpp
  5. 2
      i2pd

3
.gitignore vendored

@ -13,6 +13,9 @@ i2pbase64 @@ -13,6 +13,9 @@ i2pbase64
regaddr
routerinfo
vain
b33address
offlinekeys
regaddr_3ld
# private key files
*.dat

7
Makefile

@ -44,7 +44,7 @@ OBJECTS = $(SOURCES:.cpp=.o) @@ -44,7 +44,7 @@ OBJECTS = $(SOURCES:.cpp=.o)
I2PD_LIB = libi2pd.a
all: keygen keyinfo famtool routerinfo regaddr regaddr_3ld vain i2pbase64 offlinekeys
all: keygen keyinfo famtool routerinfo regaddr regaddr_3ld vain i2pbase64 offlinekeys b33address
routerinfo: $(OBJECTS)
$(CXX) -o routerinfo routerinfo.o $(LDFLAGS) $(LIBS)
@ -73,6 +73,9 @@ i2pbase64: $(OBJECTS) @@ -73,6 +73,9 @@ i2pbase64: $(OBJECTS)
offlinekeys: $(OBJECTS)
$(CXX) -o offlinekeys offlinekeys.o $(LDFLAGS) $(LIBS)
b33address: $(OBJECTS)
$(CXX) -o b33address b33address.o $(LDFLAGS) $(LIBS)
$(OBJECTS): libi2pd.a
.SUFFIXES:
@ -94,7 +97,7 @@ clean-obj: @@ -94,7 +97,7 @@ clean-obj:
rm -f $(OBJECTS)
clean-bin:
rm -f keyinfo keygen famtool regaddr regaddr_3ld routerinfo i2pbase64 vain offlinekeys
rm -f keyinfo keygen famtool regaddr regaddr_3ld routerinfo i2pbase64 vain offlinekeys b33address
clean: clean-i2pd clean-obj clean-bin

30
b33address.cpp

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
#include <iostream>
#include <string>
#include <memory>
#include "Identity.h"
#include "LeaseSet.h"
#include "common/key.hpp"
int main(int argc, char * argv[])
{
// base64 input, b33 and store key output, 11->11 only
std::string base64;
std::getline (std::cin, base64);
auto ident = std::make_shared<i2p::data::IdentityEx>();
if (ident->FromBase64 (base64))
{
if (ident->GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_REDDSA_SHA512_ED25519)
{
i2p::data::BlindedPublicKey blindedKey (ident, i2p::data::SIGNING_KEY_TYPE_REDDSA_SHA512_ED25519);
std::cout << "b33 address: " << blindedKey.ToB33 () << ".b32.i2p" << std::endl;
std::cout << "Today's store hash: " << blindedKey.GetStoreHash ().ToBase64 () << std::endl;
}
else
std::cout << "Invalid signature type " << SigTypeToName (ident->GetSigningKeyType ()) << std::endl;
}
else
std::cout << "Invalid base64 address" << std::endl;
return 0;
}

2
common/key.hpp

@ -50,7 +50,7 @@ static void ToUpper(std::string & str) @@ -50,7 +50,7 @@ static void ToUpper(std::string & str)
/** @brief returns the signing key number given its name or -1 if there is no key of that type */
uint16_t NameToSigType(const std::string & keyname)
{
if(keyname.size() == 1) return atoi(keyname.c_str());
if(keyname.size() <= 2) return atoi(keyname.c_str());
std::string name = keyname;
ToUpper(name);

2
i2pd

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit ff44bcc489f8a881214a1dfe522231372a0a970b
Subproject commit c4c896a833d006f308f35d31ed006e82a3b769f2
Loading…
Cancel
Save