mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-05 01:34:13 +00:00
EdDSA signature type added
This commit is contained in:
parent
454f2dabbd
commit
48289845df
12
Identity.cpp
12
Identity.cpp
@ -95,11 +95,11 @@ namespace data
|
|||||||
memcpy (excessBuf, signingKey + 128, excessLen);
|
memcpy (excessBuf, signingKey + 128, excessLen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIGNING_KEY_TYPE_EDDSA_SHA512:
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519:
|
||||||
{
|
{
|
||||||
size_t padding = 128 - i2p::crypto::EDDSA_PUBLIC_KEY_LENGTH; // 96 = 128 - 32
|
size_t padding = 128 - i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH; // 96 = 128 - 32
|
||||||
i2p::context.GetRandomNumberGenerator ().GenerateBlock (m_StandardIdentity.signingKey, padding);
|
i2p::context.GetRandomNumberGenerator ().GenerateBlock (m_StandardIdentity.signingKey, padding);
|
||||||
memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::EDDSA_PUBLIC_KEY_LENGTH);
|
memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -352,10 +352,10 @@ namespace data
|
|||||||
m_Verifier = new i2p::crypto:: RSASHA5124096Verifier (signingKey);
|
m_Verifier = new i2p::crypto:: RSASHA5124096Verifier (signingKey);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIGNING_KEY_TYPE_EDDSA_SHA512:
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519:
|
||||||
{
|
{
|
||||||
size_t padding = 128 - i2p::crypto::EDDSA_PUBLIC_KEY_LENGTH; // 96 = 128 - 32
|
size_t padding = 128 - i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH; // 96 = 128 - 32
|
||||||
m_Verifier = new i2p::crypto::EDDSAVerifier (m_StandardIdentity.signingKey + padding);
|
m_Verifier = new i2p::crypto::EDDSA25519Verifier (m_StandardIdentity.signingKey + padding);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -117,7 +117,7 @@ namespace data
|
|||||||
const uint16_t SIGNING_KEY_TYPE_RSA_SHA256_2048 = 4;
|
const uint16_t SIGNING_KEY_TYPE_RSA_SHA256_2048 = 4;
|
||||||
const uint16_t SIGNING_KEY_TYPE_RSA_SHA384_3072 = 5;
|
const uint16_t SIGNING_KEY_TYPE_RSA_SHA384_3072 = 5;
|
||||||
const uint16_t SIGNING_KEY_TYPE_RSA_SHA512_4096 = 6;
|
const uint16_t SIGNING_KEY_TYPE_RSA_SHA512_4096 = 6;
|
||||||
const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512 = 7;
|
const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519 = 7;
|
||||||
typedef uint16_t SigningKeyType;
|
typedef uint16_t SigningKeyType;
|
||||||
typedef uint16_t CryptoKeyType;
|
typedef uint16_t CryptoKeyType;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace crypto
|
|||||||
CryptoPP::Integer q, l, d, I;
|
CryptoPP::Integer q, l, d, I;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EDDSAVerifier::Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const
|
bool EDDSA25519Verifier::Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const
|
||||||
{
|
{
|
||||||
return true; // TODO:
|
return true; // TODO:
|
||||||
}
|
}
|
||||||
|
14
Signature.h
14
Signature.h
@ -412,21 +412,21 @@ namespace crypto
|
|||||||
};
|
};
|
||||||
|
|
||||||
// EdDSA
|
// EdDSA
|
||||||
const size_t EDDSA_PUBLIC_KEY_LENGTH = 32;
|
const size_t EDDSA25519_PUBLIC_KEY_LENGTH = 32;
|
||||||
const size_t EDDSA_SIGNATURE_LENGTH = 64;
|
const size_t EDDSA25519_SIGNATURE_LENGTH = 64;
|
||||||
const size_t EDDSA_PRIVATE_KEY_LENGTH = 32;
|
const size_t EDDSA25519_PRIVATE_KEY_LENGTH = 32;
|
||||||
class EDDSAVerifier: public Verifier
|
class EDDSA25519Verifier: public Verifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EDDSAVerifier (const uint8_t * signingKey)
|
EDDSA25519Verifier (const uint8_t * signingKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const;
|
bool Verify (const uint8_t * buf, size_t len, const uint8_t * signature) const;
|
||||||
|
|
||||||
size_t GetPublicKeyLen () const { return EDDSA_PUBLIC_KEY_LENGTH; };
|
size_t GetPublicKeyLen () const { return EDDSA25519_PUBLIC_KEY_LENGTH; };
|
||||||
size_t GetSignatureLen () const { return EDDSA_SIGNATURE_LENGTH; };
|
size_t GetSignatureLen () const { return EDDSA25519_SIGNATURE_LENGTH; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user