Skip to content

Commit

Permalink
Key size in KPG.initialize() is bits, not bytes :)
Browse files Browse the repository at this point in the history
  • Loading branch information
prbprbprb committed Dec 14, 2023
1 parent 2eb78fa commit c05b8bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/src/jni/main/cpp/conscrypt/native_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ static jbyteArray NativeCrypto_EVP_raw_X25519_private_key(
}

if (EVP_PKEY_get_raw_private_key(
pkey.get(), reinterpret_cast<uint8_t *>(bytes.get()),&key_length) == 0) {
pkey.get(), reinterpret_cast<uint8_t *>(bytes.get()), &key_length) == 0) {
conscrypt::jniutil::throwExceptionFromBoringSSLError(env, "EVP_PKEY_get_raw_private_key");
return nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public KeyPair generateKeyPair() {

@Override
public void initialize(int keysize, SecureRandom random) {
if (keysize != OpenSSLX25519Key.X25519_KEY_SIZE_BYTES) {
if (keysize != OpenSSLX25519Key.X25519_KEY_SIZE_BYTES * 8) {
throw new IllegalArgumentException("Only X25519 supported");
}
}
Expand Down

0 comments on commit c05b8bd

Please sign in to comment.