private int parseEncryptedDataKeyCount()

in src/main/java/com/amazonaws/encryptionsdk/model/CiphertextHeaders.java [330:343]


  private int parseEncryptedDataKeyCount(final byte[] b, final int off) throws ParseException {
    if (cipherKeyCount_ >= 0) {
      return 0;
    }
    cipherKeyCount_ = PrimitivesParser.parseUnsignedShort(b, off);
    if (cipherKeyCount_ < 0) {
      throw new BadCiphertextException("Invalid cipher key count in ciphertext");
    }
    if (maxEncryptedDataKeys_ > 0 && cipherKeyCount_ > maxEncryptedDataKeys_) {
      throw new AwsCryptoException("Ciphertext encrypted data keys exceed maxEncryptedDataKeys");
    }
    cipherKeyBlobs_ = Arrays.asList(new KeyBlob[cipherKeyCount_]);
    return Short.SIZE / Byte.SIZE;
  }