test_class.declarator: UTF_8 = Charset.forName("UTF-8")
test_class.modifier: private static final
test_class.original_string: private static final Charset UTF_8 = Charset.forName("UTF-8");
test_class.type: Charset
test_class.var_name: UTF_8
test_class.file: java_src/src/test/java/com/google/crypto/tink/hybrid/subtle/RsaKemTest.java
test_class.identifier: RsaKemTest
test_case.body: @Test
    public void generateSecret() throws Exception {
      BigInteger max = new BigInteger(2048, new Random());
      int maxSizeInBytes = RsaKem.bigIntSizeInBytes(max);
  
      Set<String> secrets = new TreeSet<>();
      for (int i = 0; i < 100; i++) {
        byte[] secret = RsaKem.generateSecret(max);
        BigInteger secretBigInt = new BigInteger(1, secret);
        secrets.add(new String(secret, UTF_8));
  
        assertThat(secret).hasLength(maxSizeInBytes);
        assertThat(secretBigInt.signum()).isEqualTo(1);
        assertThat(secretBigInt.compareTo(max)).isLessThan(0);
      }
      assertThat(secrets).hasSize(100);
    }
test_case.class_method_signature: RsaKemTest.generateSecret()
test_case.full_signature: @Test public void generateSecret()
test_case.identifier: generateSecret
test_case.invocations: bigIntSizeInBytes generateSecret add hasLength assertThat isEqualTo assertThat signum isLessThan assertThat compareTo hasSize assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void generateSecret()
focal_class.declarator: EMPTY_AAD = new byte[0]
focal_class.modifier: static final
focal_class.original_string: static final byte[] EMPTY_AAD = new byte[0];
focal_class.type: byte[]
focal_class.var_name: EMPTY_AAD
focal_class.declarator: MIN_RSA_KEY_LENGTH_BITS = 2048
focal_class.modifier: static final
focal_class.original_string: static final int MIN_RSA_KEY_LENGTH_BITS = 2048;
focal_class.type: int
focal_class.var_name: MIN_RSA_KEY_LENGTH_BITS
focal_class.file: java_src/src/main/java/com/google/crypto/tink/hybrid/subtle/RsaKem.java
focal_class.identifier: RsaKem
focal_class.class_method_signature: RsaKem.RsaKem()
focal_class.full_signature: private  RsaKem()
focal_class.identifier: RsaKem
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  RsaKem()
focal_class.class_method_signature: RsaKem.validateRsaModulus(BigInteger mod)
focal_class.full_signature: static void validateRsaModulus(BigInteger mod)
focal_class.identifier: validateRsaModulus
focal_class.modifiers: static
focal_class.parameters: (BigInteger mod)
focal_class.return: void
focal_class.signature: void validateRsaModulus(BigInteger mod)
focal_class.class_method_signature: RsaKem.bigIntSizeInBytes(BigInteger mod)
focal_class.full_signature: static int bigIntSizeInBytes(BigInteger mod)
focal_class.identifier: bigIntSizeInBytes
focal_class.modifiers: static
focal_class.parameters: (BigInteger mod)
focal_class.return: int
focal_class.signature: int bigIntSizeInBytes(BigInteger mod)
focal_class.class_method_signature: RsaKem.bigIntToByteArray(BigInteger bigInt, int size)
focal_class.full_signature: static byte[] bigIntToByteArray(BigInteger bigInt, int size)
focal_class.identifier: bigIntToByteArray
focal_class.modifiers: static
focal_class.parameters: (BigInteger bigInt, int size)
focal_class.return: byte[]
focal_class.signature: byte[] bigIntToByteArray(BigInteger bigInt, int size)
focal_class.class_method_signature: RsaKem.generateSecret(BigInteger max)
focal_class.full_signature: static byte[] generateSecret(BigInteger max)
focal_class.identifier: generateSecret
focal_class.modifiers: static
focal_class.parameters: (BigInteger max)
focal_class.return: byte[]
focal_class.signature: byte[] generateSecret(BigInteger max)
focal_class.class_method_signature: RsaKem.generateRsaKeyPair(int keySize)
focal_class.full_signature: static KeyPair generateRsaKeyPair(int keySize)
focal_class.identifier: generateRsaKeyPair
focal_class.modifiers: static
focal_class.parameters: (int keySize)
focal_class.return: KeyPair
focal_class.signature: KeyPair generateRsaKeyPair(int keySize)
focal_method.body: static byte[] generateSecret(BigInteger max) {
      int maxSizeInBytes = bigIntSizeInBytes(max);
      Random rand = new SecureRandom();
      BigInteger r;
      do {
        r = new BigInteger(max.bitLength(), rand);
      } while (r.signum() <= 0 || r.compareTo(max) >= 0);
  
      return bigIntToByteArray(r, maxSizeInBytes);
    }
focal_method.class_method_signature: RsaKem.generateSecret(BigInteger max)
focal_method.full_signature: static byte[] generateSecret(BigInteger max)
focal_method.identifier: generateSecret
focal_method.invocations: bigIntSizeInBytes bitLength signum compareTo bigIntToByteArray
focal_method.modifiers: static
focal_method.parameters: (BigInteger max)
focal_method.return: byte[]
focal_method.signature: byte[] generateSecret(BigInteger max)