A,B,B param sets for GOST R 34.10

This commit is contained in:
orignal 2017-03-10 16:57:56 -05:00
parent 7caf3ea7d0
commit bd8cdd345a
2 changed files with 29 additions and 1 deletions

View File

@ -103,6 +103,8 @@ namespace data
break;
}
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
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
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (i2p::crypto::eGOSTR3410CryptoProA, m_StandardIdentity.signingKey + padding));
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:
LogPrint (eLogError, "Identity: Signing key type ", (int)keyType, " is not supported");
}
@ -527,6 +541,12 @@ namespace data
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (i2p::crypto::eGOSTR3410CryptoProA, m_SigningPrivateKey));
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:
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:
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProA, keys.m_SigningPrivateKey, signingPublicKey);
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:
LogPrint (eLogError, "Identity: Signing key type ", (int)type, " is not supported. Create DSA-SHA1");
return PrivateKeys (i2p::data::CreateRandomKeys ()); // DSA-SHA1

View File

@ -62,6 +62,8 @@ namespace data
const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519 = 7;
// 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_B_GOSTR3411 = 65281;
const uint16_t SIGNING_KEY_TYPE_GOSTR3410_C_GOSTR3411 = 65282;
typedef uint16_t SigningKeyType;
typedef uint16_t CryptoKeyType;