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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to