You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2023/01/06 20:30:20 UTC

[GitHub] [solr] risdenk commented on a diff in pull request #1279: SOLR-16613: CryptoKeys should handle RSA padding for OpenJ9

risdenk commented on code in PR #1279:
URL: https://github.com/apache/solr/pull/1279#discussion_r1063768185


##########
solr/core/src/test/org/apache/solr/cloud/TestRSAKeyPair.java:
##########
@@ -36,26 +38,29 @@ public void testGenKeyPair() throws Exception {
   public void testReadKeysFromDisk() throws Exception {
     URL privateKey = getClass().getClassLoader().getResource("cryptokeys/priv_key512_pkcs8.pem");
     URL publicKey = getClass().getClassLoader().getResource("cryptokeys/pub_key512.der");
-
+    assertNotNull(privateKey);
+    assertNotNull(publicKey);
     testRoundTrip(new CryptoKeys.RSAKeyPair(privateKey, publicKey));
   }
 
   private void testRoundTrip(CryptoKeys.RSAKeyPair kp) throws Exception {
-    final byte[] plaintext = new byte[random().nextInt(64)];
-    random().nextBytes(plaintext);

Review Comment:
   random().nextBytes() would end up with null bytes and that would cause issues. I switched this to generate a regular string with no null bytes.



##########
solr/core/src/java/org/apache/solr/util/CryptoKeys.java:
##########
@@ -295,15 +304,28 @@ public PublicKey getPublicKey() {
       return publicKey;
     }
 
-    public byte[] encrypt(ByteBuffer buffer) {

Review Comment:
   We only call `ByteBuffer.wrap` in all invocations of this so isn't helpful to have this as a `ByteBuffer`. The decryption also just uses a plain `byte[]` so this makes it consistent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org