code: static boolean isCOctetStringNullOrNValValid(String value,
              int length) {
          if (value == null) {
              return true;
          }
          
          if (value.length() == 0) {
              return true;
          }
          
          if (value.length() == length - 1) {
              return true;
          }
          return false;
      }
docs: Validate the C-Octet String
  
  @param value
  @param length
  @return