mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-27 04:54:14 +00:00
A,B,B param sets for GOST R 34.10
This commit is contained in:
parent
7caf3ea7d0
commit
bd8cdd345a
28
Identity.cpp
28
Identity.cpp
@ -103,6 +103,8 @@ namespace data
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_B_GOSTR3411:
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411:
|
||||||
{
|
{
|
||||||
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
||||||
RAND_bytes (m_StandardIdentity.signingKey, padding);
|
RAND_bytes (m_StandardIdentity.signingKey, padding);
|
||||||
@ -382,7 +384,19 @@ namespace data
|
|||||||
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
||||||
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (i2p::crypto::eGOSTR3410CryptoProA, m_StandardIdentity.signingKey + padding));
|
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (i2p::crypto::eGOSTR3410CryptoProA, m_StandardIdentity.signingKey + padding));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_B_GOSTR3411:
|
||||||
|
{
|
||||||
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
||||||
|
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (i2p::crypto::eGOSTR3410CryptoProB, m_StandardIdentity.signingKey + padding));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411:
|
||||||
|
{
|
||||||
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
||||||
|
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (i2p::crypto::eGOSTR3410CryptoProC, m_StandardIdentity.signingKey + padding));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
LogPrint (eLogError, "Identity: Signing key type ", (int)keyType, " is not supported");
|
LogPrint (eLogError, "Identity: Signing key type ", (int)keyType, " is not supported");
|
||||||
}
|
}
|
||||||
@ -527,6 +541,12 @@ namespace data
|
|||||||
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
||||||
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (i2p::crypto::eGOSTR3410CryptoProA, m_SigningPrivateKey));
|
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (i2p::crypto::eGOSTR3410CryptoProA, m_SigningPrivateKey));
|
||||||
break;
|
break;
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_B_GOSTR3411:
|
||||||
|
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (i2p::crypto::eGOSTR3410CryptoProB, m_SigningPrivateKey));
|
||||||
|
break;
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411:
|
||||||
|
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (i2p::crypto::eGOSTR3410CryptoProC, m_SigningPrivateKey));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LogPrint (eLogError, "Identity: Signing key type ", (int)m_Public->GetSigningKeyType (), " is not supported");
|
LogPrint (eLogError, "Identity: Signing key type ", (int)m_Public->GetSigningKeyType (), " is not supported");
|
||||||
}
|
}
|
||||||
@ -565,6 +585,12 @@ namespace data
|
|||||||
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
|
||||||
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProA, keys.m_SigningPrivateKey, signingPublicKey);
|
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProA, keys.m_SigningPrivateKey, signingPublicKey);
|
||||||
break;
|
break;
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_B_GOSTR3411:
|
||||||
|
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProB, keys.m_SigningPrivateKey, signingPublicKey);
|
||||||
|
break;
|
||||||
|
case SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411:
|
||||||
|
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProC, keys.m_SigningPrivateKey, signingPublicKey);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LogPrint (eLogError, "Identity: Signing key type ", (int)type, " is not supported. Create DSA-SHA1");
|
LogPrint (eLogError, "Identity: Signing key type ", (int)type, " is not supported. Create DSA-SHA1");
|
||||||
return PrivateKeys (i2p::data::CreateRandomKeys ()); // DSA-SHA1
|
return PrivateKeys (i2p::data::CreateRandomKeys ()); // DSA-SHA1
|
||||||
|
@ -62,6 +62,8 @@ namespace data
|
|||||||
const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519 = 7;
|
const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519 = 7;
|
||||||
// following signature type should never appear in netid=2
|
// following signature type should never appear in netid=2
|
||||||
const uint16_t SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411 = 65280; // approved by FSB
|
const uint16_t SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411 = 65280; // approved by FSB
|
||||||
|
const uint16_t SIGNING_KEY_TYPE_GOSTR3410_B_GOSTR3411 = 65281;
|
||||||
|
const uint16_t SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411 = 65282;
|
||||||
|
|
||||||
typedef uint16_t SigningKeyType;
|
typedef uint16_t SigningKeyType;
|
||||||
typedef uint16_t CryptoKeyType;
|
typedef uint16_t CryptoKeyType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user