|
|
@ -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); |
|
|
@ -383,6 +385,18 @@ namespace data |
|
|
|
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
|
|
|
|