grpc
third_party
boringssl-with-bazel
src
tool
generate_ed25519.cc
Go to the documentation of this file.
1
/* Copyright (c) 2015, Google Inc.
2
*
3
* Permission to use, copy, modify, and/or distribute this software for any
4
* purpose with or without fee is hereby granted, provided that the above
5
* copyright notice and this permission notice appear in all copies.
6
*
7
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15
#include <
openssl/curve25519.h
>
16
17
#include <
errno.h
>
18
#include <stdio.h>
19
#include <
string.h
>
20
21
#include "
internal.h
"
22
23
24
static
const
struct
argument
kArguments
[] = {
25
{
26
"-out-public"
,
kRequiredArgument
,
"The file to write the public key to"
,
27
},
28
{
29
"-out-private"
,
kRequiredArgument
,
30
"The file to write the private key to"
,
31
},
32
{
33
""
,
kOptionalArgument
,
""
,
34
},
35
};
36
37
bool
GenerateEd25519Key
(
const
std::vector<std::string> &
args
) {
38
std::map<std::string, std::string> args_map;
39
40
if
(!
ParseKeyValueArguments
(&args_map,
args
,
kArguments
)) {
41
PrintUsage
(
kArguments
);
42
return
false
;
43
}
44
45
uint8_t
public_key
[32],
private_key
[64];
46
ED25519_keypair
(
public_key
,
private_key
);
47
48
return
WriteToFile
(args_map[
"-out-public"
],
public_key
) &&
49
WriteToFile
(args_map[
"-out-private"
],
private_key
);
50
}
ParseKeyValueArguments
bool ParseKeyValueArguments(std::map< std::string, std::string > *out_args, const std::vector< std::string > &args, const struct argument *templates)
Definition:
args.cc:27
public_key
Definition:
hrss.c:1881
internal.h
kRequiredArgument
@ kRequiredArgument
Definition:
third_party/boringssl-with-bazel/src/tool/internal.h:103
ED25519_keypair
#define ED25519_keypair
Definition:
boringssl_prefix_symbols.h:1395
WriteToFile
bool WriteToFile(const std::string &path, bssl::Span< const uint8_t > in)
Definition:
boringssl-with-bazel/src/tool/file.cc:56
string.h
uint8_t
unsigned char uint8_t
Definition:
stdint-msvc2008.h:78
asyncio_get_stats.args
args
Definition:
asyncio_get_stats.py:40
argument
Definition:
third_party/boringssl-with-bazel/src/tool/internal.h:108
PrintUsage
void PrintUsage(const struct argument *templates)
Definition:
args.cc:75
private_key
Definition:
hrss.c:1885
GenerateEd25519Key
bool GenerateEd25519Key(const std::vector< std::string > &args)
Definition:
generate_ed25519.cc:37
curve25519.h
kArguments
static const struct argument kArguments[]
Definition:
generate_ed25519.cc:24
kOptionalArgument
@ kOptionalArgument
Definition:
third_party/boringssl-with-bazel/src/tool/internal.h:104
errno.h
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:25