|
|
@ -102,6 +102,13 @@ namespace data |
|
|
|
memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH); |
|
|
|
memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
|
|
|
|
|
|
|
RAND_bytes (m_StandardIdentity.signingKey, padding); |
|
|
|
|
|
|
|
memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
LogPrint (eLogError, "Identity: Signing key type ", (int)type, " is not supported"); |
|
|
|
LogPrint (eLogError, "Identity: Signing key type ", (int)type, " is not supported"); |
|
|
|
} |
|
|
|
} |
|
|
@ -370,6 +377,12 @@ namespace data |
|
|
|
UpdateVerifier (new i2p::crypto::EDDSA25519Verifier (m_StandardIdentity.signingKey + padding)); |
|
|
|
UpdateVerifier (new i2p::crypto::EDDSA25519Verifier (m_StandardIdentity.signingKey + padding)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
size_t padding = 128 - i2p::crypto::GOSTR3410_PUBLIC_KEY_LENGTH; // 64 = 128 - 64
|
|
|
|
|
|
|
|
UpdateVerifier (new i2p::crypto::GOSTR3410Verifier (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"); |
|
|
|
} |
|
|
|
} |
|
|
@ -511,6 +524,9 @@ namespace data |
|
|
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: |
|
|
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: |
|
|
|
m_Signer.reset (new i2p::crypto::EDDSA25519Signer (m_SigningPrivateKey, m_Public->GetStandardIdentity ().certificate - i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH)); |
|
|
|
m_Signer.reset (new i2p::crypto::EDDSA25519Signer (m_SigningPrivateKey, m_Public->GetStandardIdentity ().certificate - i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411: |
|
|
|
|
|
|
|
m_Signer.reset (new i2p::crypto::GOSTR3410Signer (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"); |
|
|
|
} |
|
|
|
} |
|
|
@ -546,6 +562,9 @@ namespace data |
|
|
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: |
|
|
|
case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: |
|
|
|
i2p::crypto::CreateEDDSA25519RandomKeys (keys.m_SigningPrivateKey, signingPublicKey); |
|
|
|
i2p::crypto::CreateEDDSA25519RandomKeys (keys.m_SigningPrivateKey, signingPublicKey); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411: |
|
|
|
|
|
|
|
i2p::crypto::CreateGOSTR3410RandomKeys (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
|
|
|
|